-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
MPSC Sender channel not dropping buffer when all Receivers are dropped during a thread panic unwind #107466
Comments
bisection seems to point to afd7977 cc @Amanieu searched nightlies: from nightly-2022-11-01 to nightly-2023-02-01 bisected with cargo-bisect-rustc v0.6.5Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --start=2022-11-01 --end=2023-02-01 --script ./script.sh |
In crossbeam, the unbounded channel does this (crossbeam-rs/crossbeam#669), but the bounded channel does not. There is no particular intent, it just hasn't been implemented. cc @ibraheemdev |
Tests that messages are immediately dropped once the last receiver is destroyed.
968: channel: Extend panic_on_drop test r=taiki-e a=taiki-e Include rust-lang/rust#107466 's case. cc rust-lang/rust#108164 Co-authored-by: Taiki Endo <[email protected]>
…, r=Amanieu Drop all messages in bounded channel when destroying the last receiver Fixes rust-lang#107466 by splitting the `disconnect` function for receivers/transmitters and dropping all messages in `disconnect_receivers` like the unbounded channel does. Since all receivers must be dropped before the channel is, the messages will already be discarded at that point, so the `Drop` implementation for the channel can be removed. `@rustbot` label +T-libs +A-concurrency
The code is identical except that rust-lang/rust#107466 is fixed in std but not in crossbeam-channel. I originally reworked this because the bug in 80ff3ff made me desparate to suspect something is wrong with the channel. While it didn't turn out to be an issue with the channels I still think it's good to depend on std code instead of a library. Signed-off-by: Gerd Zellweger <[email protected]>
The code is identical except that rust-lang/rust#107466 is fixed in std but not in crossbeam-channel. I originally reworked this because the bug in 80ff3ff made me desparate to suspect something is wrong with the channel. While it didn't turn out to be an issue with the channels I still think it's good to depend on std code instead of a library. Signed-off-by: Gerd Zellweger <[email protected]>
The code is identical except that rust-lang/rust#107466 is fixed in std but not in crossbeam-channel. I originally reworked this because the bug in 80ff3ff made me desparate to suspect something is wrong with the channel. While it didn't turn out to be an issue with the channels I still think it's good to depend on std code instead of a library. Signed-off-by: Gerd Zellweger <[email protected]>
The code is identical except that rust-lang/rust#107466 is fixed in std but not in crossbeam-channel. I originally reworked this because the bug in 80ff3ff made me desparate to suspect something is wrong with the channel. While it didn't turn out to be an issue with the channels I still think it's good to depend on std code instead of a library. Signed-off-by: Gerd Zellweger <[email protected]>
The code is identical except that rust-lang/rust#107466 is fixed in std but not in crossbeam-channel. I originally reworked this because the bug in 80ff3ff made me desparate to suspect something is wrong with the channel. While it didn't turn out to be an issue with the channels I still think it's good to depend on std code instead of a library. Signed-off-by: Gerd Zellweger <[email protected]>
Code
I tried this code:
I expected to see this happen: I expected to see the struct
Foo
in the Sender buffer get dropped after the Receiver is dropped during the unwind of the panicking thread.Instead, this happened: The data in the Sender buffer is not dropped until the whole process ends.
Version it worked on
It most recently worked on: 1.66.1
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: