Amanieu / thread_local-rs

Per-object thread-local storage for Rust
Apache License 2.0
328 stars 41 forks source link

`miri` reports leaking memory with 1.1.5 #45

Closed TimDiekmann closed 1 year ago

TimDiekmann commented 1 year ago

Hello 👋🏻

With the latest release of thread_local, miri reports a memory leak. I tracked this down to the version bump of thread_local v1.1.5.

This is the output of miri:

     Running tests/test_span_trace.rs (target/miri/x86_64-unknown-linux-gnu/debug/deps/test_span_trace-315bdddcdb7b9126)

running 2 tests
test captured ... ok
test provided ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

The following memory was leaked: alloc281964 (Rust heap, size: 64, align: 8) {
    0x00 │ 01 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
    0x10 │ 02 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ │ .........░░░░░░░
    0x20 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
    0x30 │ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ ░░░░░░░░░░░░░░░░
}

error: the evaluated program leaked memory

note: pass `-Zmiri-ignore-leaks` to disable this check

error: aborting due to previous error
TimDiekmann commented 1 year ago

I was able to track down the bug further. The bug happened after https://github.com/Amanieu/thread_local-rs/pull/44 was merged.

Amanieu commented 1 year ago

Can you get a backtrace of where the leak came from? It's not obvious to me what is causing this.

Amanieu commented 1 year ago

Nevermind, I found the problem and yanked 1.1.5.

terrarier2111 commented 1 year ago

Will there be a new release including a patch for this issue?

Amanieu commented 1 year ago

Fixed in 1.1.6.

TimDiekmann commented 1 year ago

Thanks for the quick actions!