-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Valgrind leak check reports a "possibly lost" leak on std::thread::current()
#135608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is this a full leakcheck? |
Yes. |
Based on the consensus in #133574, non-default full leakcheck is "convenience if we can, but no hard guarantees", removing regression and prioritize labels. |
std::thread::current()
(again)std::thread::current()
(I edited the issue title to better reflect this requires valgrind full leak check) |
To be clear, all a full leak check does is enable more logs. I get this even without full leak check:
So you can still see those 48 "possibly lost" bytes and wonder where they come from. IMO renaming this issue is misleading, and, again, IMO, feel free to disagree -- it's still a kind of regression. |
std::thread::current()
std::thread::current()
std::thread::current()
std::thread::current()
I did the initial triaging, I'll let the T-libs maintainers re-triage if this should be considered a regression. Thanks for the further clarifications. |
@joboet Is this an inevitable result of your preferred design for handling the thread allocations? |
This is basically an instance of #28129. After #127912, the destructor for the TLS variable behind I think this is fixed by #134085, which uses |
This is the minimal crate, where `cargo valgrind` must never report any issues. If that test fails, then there is a leak in the Rust standard library, which is [reported to be allowed][leak-issue]: > Based on the consensus in rust-lang/rust#133574, non-default full > leakcheck is "convenience if we can, but no hard guarantees", [...]. This test is the earliest integration test by naming it `a...`, so that this very error is caught first and with a clearer error message thanks to the descriptive test name. [leak-issue]: rust-lang/rust#135608 (comment)
This is the minimal crate, where `cargo valgrind` must never report any issues. If that test fails, then there is a leak in the Rust standard library, which is [reported to be allowed][leak-issue]: > Based on the consensus in rust-lang/rust#133574, non-default full > leakcheck is "convenience if we can, but no hard guarantees", [...]. This test is the earliest integration test by naming it `a...`, so that this very error is caught first and with a clearer error message thanks to the descriptive test name. [leak-issue]: rust-lang/rust#135608 (comment)
This is the minimal crate, where `cargo valgrind` must never report any issues. If that test fails, then there is a leak in the Rust standard library, which is [reported to be allowed][leak-issue]: > Based on the consensus in rust-lang/rust#133574, non-default full > leakcheck is "convenience if we can, but no hard guarantees", [...]. This test is the earliest integration test by naming it `a...`, so that this very error is caught first and with a clearer error message thanks to the descriptive test name. [leak-issue]: rust-lang/rust#135608 (comment)
## Background Valgrind may detect leaks in the Rust standard library as it has done in the past (e.g. [here][rust1.83] and [here][beta]). Those "leaks" report- ed by Valgrind are not considered as leaks by the Rust team when they are small permanent allocation, which is not growing (as described [here][comment-1]) and there is no guarantee, that the Rust standard library is free of memory leaks (as described [here][comment-2]). There- fore some reports of Valgrind are entirely non-actionable by a user of this crate. In order to solve this, this PR addds a list of suppressions for the Rust `std`. Those are applied automatically, so that those "leaks" are never reported to the user. New suppressions should be added when leaks are detected in the [periodic test against the beta compiler][beta-job], but only after reporting them to the [Rust team][new-rust-issue] as documented in the new `suppressions/README.md`. The implementation is conceptually simple, but a bit tricky in the im- plementation: the suppression files are added to the `suppressions`-di- rectory and should be used by `cargo-valgrind` when running. But that directory is not available at runtime. Therefore the files need to be embedded into the binary. This is done by two co-working parts: 1. the build script, which reads all files in the `suppressions`-folder and writes their contents to a constant string `SUPPRESSIONS` and 2. the runtime code which crates a temporary file containing the afore- mentioned constant string. This file is then used as the argument to the `--suppressions`-option. [rust1.83]: rust-lang/rust#133574 [beta]: rust-lang/rust#138430 [comment-1]: rust-lang/rust#133574 (comment) [comment-2]: rust-lang/rust#135608 (comment) [beta-job]: https://github.com/jfrimmel/cargo-valgrind/actions/workflows/beta.yaml [new-rust-issue]: https://github.com/rust-lang/rust/issues/new?template=regression.md
Hello, am I correct under the assumption that this wont be fixed in a future rust version? |
…st#135608 The Valgrind .supp file was generated with `valgrind --leak-check=full --gen-suppressions=yes --show-leak-kinds=all target/debug/examples/shutdown` and manually named and commited.
Code
I tried this code:
...under
valgrind
.I expected to see this happen: no leaks
Instead, this happened:
This is basically #133574 again. Calling this a regression might be stretching it a bit too far, but the consensus on that issue seemed to be that we should fix this if we can.
Version it worked on
It most recently worked on: Rust 1.85.0-beta.2, as far as I'm aware
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: