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

Fix v9 Send breaking Open Telemetry #3243

Merged
merged 1 commit into from
Aug 7, 2024
Merged

Fix v9 Send breaking Open Telemetry #3243

merged 1 commit into from
Aug 7, 2024

Conversation

preardon
Copy link
Member

@preardon preardon commented Aug 7, 2024

When running Send Async and there is an error this can cause a Span the be compelted that should not be and then leaks into the Activity in the higher context which will cause thigns to be related that are not

@catalintoma
Copy link
Contributor

The reason for this is that disposing an activity also resets Activity.Current to the previous activity (or null for root).
But because Activity.Current is defined as AsyncLocal, it means that when control gets back to MessagePump it is re-assigned.
Since it's stopped by command processor, nothing happens above.

On the next message the pump handles, we expect a null current Activity and it is not. That means that all requests will now be a child of the previous one.

https://medium.com/net-under-the-hood/hidden-workings-of-execution-context-in-net-43b491726c65

@preardon preardon merged commit 3430d02 into release/9X Aug 7, 2024
16 of 17 checks passed
@preardon preardon deleted the fixv9Otel branch August 7, 2024 15:44
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