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
Fix leak in LocalSet #3978
Fix leak in LocalSet #3978
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. I asked @hawkw to take a quick look as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks right to me, good catch!
use std::task::Poll; | ||
|
||
#[test] | ||
fn wake_during_shutdown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to have a comment explaining what the failure modes of this test are, for future reference? not a blocker though.
.queue | ||
.lock() | ||
.as_mut() | ||
.and_then(|queue| queue.pop_front()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIOLI: it seems like queue.lock().as_mut().and_then(|queue| queue.pop_front())
could be worth making a method on Shared
, but 🤷♀️
If a task is woken during shutdown, it is possible for it to remain in the shared queue after shutting down the
LocalSet
, which would be a leak due to a ref-count cycle. This PR provides a fix. TheEnable loom test
commit was pushed first without the fix to show that the test really fails.