Skip to content
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

Prevent duplicate Observation.stop with Micrometer #3976

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

chemicL
Copy link
Member

@chemicL chemicL commented Jan 27, 2025

This change prevents multiple Observation.stop calls with proper guardrails in MicrometerObservationListener. Since cancellation can happen out-of-band on a different Thread, a volatile state has been introduced to prevent duplicate Observation terminations.

Resolves #3972

As a side note, this is similar to the issue described in spring-projects/spring-framework#31417 and the solution is similar, yet more low level.

This change prevents multiple `Observation.stop` calls with proper
guardrails in `MicrometerObservationListener`. Since cancellation can
happen out-of-band on a different `Thread`, a `volatile` state has been
introduced to prevent duplicate `Observation` terminations.

Resolves #3972

Signed-off-by: Dariusz Jędrzejczyk <[email protected]>
@chemicL chemicL added this to the 3.6.14 milestone Jan 27, 2025
@chemicL chemicL requested a review from a team as a code owner January 27, 2025 10:48
@chemicL chemicL merged commit 6c9d22f into 3.6.x Jan 27, 2025
7 checks passed
@chemicL chemicL deleted the micrometer-observations-double-stop branch January 27, 2025 12:00
@chemicL
Copy link
Member Author

chemicL commented Jan 27, 2025

@violetagg thank you for the review :)

chemicL added a commit that referenced this pull request Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants