-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use locks to serialize arm/disarm actions #1066
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…duce nesting where possible
danielmarbach
approved these changes
Oct 1, 2024
src/Transport/Receiving/RepeatedFailuresOverTimeCircuitBreaker.cs
Outdated
Show resolved
Hide resolved
This was referenced Oct 2, 2024
DavidBoike
added a commit
that referenced
this pull request
Oct 2, 2024
* Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
DavidBoike
added a commit
that referenced
this pull request
Oct 2, 2024
* Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
DavidBoike
added a commit
that referenced
this pull request
Oct 2, 2024
* Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
DavidBoike
added a commit
that referenced
this pull request
Oct 2, 2024
* Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
danielmarbach
added a commit
that referenced
this pull request
Oct 2, 2024
…1062) * Address races in the repeated failure circuit breaker by introducing explicit state transitions (#1057) * Use locks to serialize arm/disarm actions (#1066) * Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Adapt update to older C# version --------- Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net> Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
danielmarbach
added a commit
that referenced
this pull request
Oct 2, 2024
* Address races in the repeated failure circuit breaker by introducing explicit state transitions (#1057) * Try address races in the repeated failure circuit breaker * Address races in the repeated failure circuit breaker * Improve log message --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Update the processing capacity consistently together with the prefetch count to make sure during throttling the number of prefetched messages is kept aligned with the settings of the user (#1058) Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Use locks to serialize arm/disarm actions (#1066) * Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> --------- Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net> Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
danielmarbach
added a commit
that referenced
this pull request
Oct 2, 2024
* Address races in the repeated failure circuit breaker by introducing explicit state transitions (#1057) * Try address races in the repeated failure circuit breaker * Address races in the repeated failure circuit breaker * Improve log message --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Update the processing capacity consistently together with the prefetch count to make sure during throttling the number of prefetched messages is kept aligned with the settings of the user (#1058) Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Use locks to serialize arm/disarm actions (#1066) * Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> --------- Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net> Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
danielmarbach
added a commit
that referenced
this pull request
Oct 2, 2024
* Address races in the repeated failure circuit breaker by introducing explicit state transitions (#1057) * Try address races in the repeated failure circuit breaker * Address races in the repeated failure circuit breaker * Improve log message --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Update the processing capacity consistently together with the prefetch count to make sure during throttling the number of prefetched messages is kept aligned with the settings of the user (#1058) Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> * Use locks to serialize arm/disarm actions (#1066) * Use locks to serialize arm/disarm actions * Explicit state lock, Volatile read of state outside lock, actually reduce nesting where possible * Small cosmetics for better readability * Better logging * Verbose comment * Even better logging * Basic test coverage --------- Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com> --------- Co-authored-by: Daniel Marbach <daniel.marbach@openplace.net> Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Serializing the arm/disarm actions is not enough. The state transition preceding the arm/disarm action must be captured in the lock as well, otherwise the state transitions could happen properly but then the arm/disarm actions could be executed by the processor in the wrong order, leaving the logic of the circuit breaker itself intact but the consequences of the arm/disarm actions in an incorrect state.
I also added xdoc as a way to document that the arm/disarm actions are called within a lock, and to maybe pave the way for this to be used as a shared component.