Skip to content

Fix race condition in RepeatedFailuresOverTimeCircuitBreaker#1555

Merged
WilliamBZA merged 4 commits intomasterfrom
repeated-failures-over-time-fix
Jun 18, 2025
Merged

Fix race condition in RepeatedFailuresOverTimeCircuitBreaker#1555
WilliamBZA merged 4 commits intomasterfrom
repeated-failures-over-time-fix

Conversation

@WilliamBZA
Copy link
Member

A port of Particular/NServiceBus.Transport.AzureServiceBus#1066

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.

@WilliamBZA WilliamBZA requested review from afprtclr and hsvotwa June 11, 2025 08:29
@WilliamBZA WilliamBZA force-pushed the repeated-failures-over-time-fix branch 5 times, most recently from cd97699 to 27622db Compare June 11, 2025 08:49
@WilliamBZA WilliamBZA merged commit f493f1a into master Jun 18, 2025
4 checks passed
@WilliamBZA WilliamBZA deleted the repeated-failures-over-time-fix branch June 18, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants