You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hub::configure_scope can lose concurrent updates on a shared Hub #1110
Hub::configure_scope clones the current scope under a read lock, invokes the callback on the clone, then replaces the current scope under a later write lock. Two concurrent calls on the same shared Hub can therefore clone the same initial scope, and the later replacement can discard the earlier mutation.
This is a correctness issue for shared Hub instances: concurrent scope modifications can result in data loss when independent mutations are made to the same shared scope.
Expected behavior: concurrent configure_scope calls on the same Hub should apply mutations atomically with respect to each other, or the API documentation should state that concurrent updates may overwrite each other. One possible fix is to run the scope mutation while holding the write lock, for example through with_current_scope_mut; the implementation should account for the existing constraint that calling scope-related Sentry APIs from inside the callback is unsupported and may panic.
This actually seems like a documentation issue. The issue was originally discovered by Claude, but it seems that we already state in the crate-level docs that using Hubs concurrently "may lead to unexpected results up to panics."
I am therefore treating this as a docs issue and adding some docs on the Hub and the configure_scope method to clarify that concurrent use of hubs, although safe, is not recommended.
Activity
linear-code commentedon May 5, 2026
RUST-208
szokeasaurusrex commentedon Aug 4, 2026
This actually seems like a documentation issue. The issue was originally discovered by Claude, but it seems that we already state in the crate-level docs that using Hubs concurrently "may lead to unexpected results up to panics."
I am therefore treating this as a docs issue and adding some docs on the
Huband theconfigure_scopemethod to clarify that concurrent use of hubs, although safe, is not recommended.docs(hub): Clarify concurrent Hub usage (#1280)