-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: stopped watching of resources - avoid overflow exceptions in resource watcher OnException handle… #505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about the number?
The rest seems perfectly fine to me. I'm happy to merge it if you gave me your opinion on my comment.
And of course: Thank you for contributing to this project! <3 |
Linting and testing must succeed for the PR to be merged. |
I will check it, but the master branch from which I forked is in erroneous state, too, |
Head branch was pushed to by a user without write access
You were right. I tried to fix the linting issues in the second commit. Can I run the analyzer somehow from here, please? |
Yea, if you push to this PR, I can approve and run the analyzer. Also, if you see any warnings during "build whole solution", this is a strong indicator that the build is going to fail. All warnings produce errors in production mode. |
This PR provides a fix for the resource watcher's exp. backoff reconnection logic. After reaching the bellow explained retry attempts threshold the reconciliation of the watched resources halts.
…r #482
Description:
The
_reconnectHandler
publisher (IObserver<TimeSpan>
part of theISubject<TimeSpan>
) stops emitting new values into the pipeline after 40 consecutively failed reconnection attempts due to an unhandled overflow exception and the reconnection subscription represented by theIObservable<Timespan>
would remain idle, but the background thread is unnoticedly aborted.The PR provides the following improvements and fixes:
_reconnectAttempts
variable against a constantMaxRetriesAttempts
with value set to 39 attempts in order to avoidSystem.OverflowException
thrown from theErrorBackoffStrategy
delegate.OnException
event handler is wrapped with a try-catch-finally block. The finally block ensures that new values - interpreted as Timer ticks ensuring latency between inversion of control invocations - will be produced in case of arbitrary exceptions in the future.Retry
operator into the reconnection handler's subscription pipeline and logs errors onOnError
messages.Let me know if I should move some or all of the following
MaxRetriesAttempts
logic, constant and theDefaultBackoff
property directly into theBackoffStrategies
static class. This would lead to a more implicit (hidden) error guard.DefaultBackoff
is necessary in case of introducing a finally block in theOnException
method.I could also introduce some unit tests for the
ResourceWatcher<TEntity>
class by injectingSystem.Reactive.Concurrency.IScheduler
into its constructor in order to mock time and threads.Operators without proper unobserved thread error logging are unaware about the issue. I would recommend to log such errors in the following way: