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
Darwin DeerBook 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Crates
tracing-subscriber
Description
If I exit a span created from something using Registry (such as FmtSubscriber) while its associated dispatch is not the default dispatch, Registry will ask the default dispatch to try_close() the span id. This means it's asking the wrong dispatch to close it, which can lead to panics.
Reproduction
let outer = tracing_subscriber::fmt().set_default();let one = info_span!("one").entered();let inner = tracing_subscriber::fmt().set_default();let two = info_span!("two").entered();drop(one);// this closes span twodrop(two);// this panics
thread 'main' panicked at 'tried to drop a ref to Id(1), but no such span exists!', /Users/lily/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.25/src/registry/sharded.rs:346:21
The text was updated successfully, but these errors were encountered:
The neatest solution to this is probably just to change the Registry type to not need to get the current default dispatch in try_close...which I started experimenting with in #1505. Unfortunately, this requires some API changes, and introduces a few new issues I haven't quite had the time to work out.
Another option is to change the Span type to set its Dispatch as the default for the duration of the try_close call, but this seems like an unfortunate perf hit...
Bug Report
Version
Platform
Darwin DeerBook 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Crates
tracing-subscriber
Description
If I exit a span created from something using
Registry
(such asFmtSubscriber
) while its associated dispatch is not the default dispatch,Registry
will ask the default dispatch totry_close()
the span id. This means it's asking the wrong dispatch to close it, which can lead to panics.Reproduction
The text was updated successfully, but these errors were encountered: