tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.48k stars 721 forks source link

Panics when using tracing_subscriber::fmt().with_test_writer() #1203

Open olix0r opened 3 years ago

olix0r commented 3 years ago

Using tracing-subscriber v0.2.15, we have tests instrumented like:

#[tokio::test]
async fn test() {
  let _ = tracing_subscriber::fmt().with_test_writer().try_init();
  ...
}

This can cause tests to fail with:

tcache_thread_shutdown(): unaligned tcache chunk detected
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: ... (signal: 6, SIGABRT: process abort signal)

I've disabled use of the subscriber with a feature-flag for now: https://github.com/linkerd/linkerd2-proxy/pull/873

olix0r commented 3 years ago

It's worth noting that doesn't appear to happen with all tests that use this; but disabling this single line is enough to avoid panics in our outbound tests.

In https://github.com/linkerd/linkerd2-proxy/pull/873, the following command reliably panics:

:; (cd linkerd/app/outbound && cargo test --features=test-subscriber  -- tcp)