getsentry / getsentry/sentry-rust

Threads mistakenly attach to main thread's span

Open
#674 8 comments 0 reactions 0 assignees View on GitHub
Bug Rust Spans
Dominant language
Rust
Stars
752
Forks
190
Avg merge
1h 21m
Merged PRs (30d)
5

Description

The first time we call sentry-related functions in a thread, it attaches to whichever *Span* the main thread is currently attached to.
This causes very wrong sub-spanning (which I just spend 6 hours investigating).
Attaching to sentry client, DSN, parameters..., etc seems correct, but span definitely not.

I feel like maybe the *Scope* should be a property that's not inherited from whichever scope the main thread happens to be in at that moment, because if there is a sub-thread it's very possible that the main thread is doing unrelated work at that moment, and that unrelated work may very well involve its own spans and data, so it seems that it's not correct to attach to those.

Related issues: [RUST-25](https://linear.app/getsentry/issue/RUST-25/provide-examples-for-async-use-of-hub)
Related writeup: [https://swatinem.de/blog/log-contexts/]()

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.