Skip to content

Fix a leak in FutureState when a Notifier is dropped un-woken #2233

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

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

If a Notifier has an internal FutureState which gathers some
sleeper callbacks, but is never actaully woken, those callbacks
will leak due to a circular Arc reference when the Notifier is
drop'd.

Because Notifiers are rarely drop'd in production this isn't a
huge deal, but shows up materially in bindings tests as they spawn
many nodes over the course of a short test.

Fixes #2232

Note that I'd like to include this in the 115 bindings release just to shut up the leak detection used there, which is quite angry.

This will allow us to pass in that state to the callbacks in the
next commit.
If a `Notifier` has an internal `FutureState` which gathers some
sleeper callbacks, but is never actaully woken, those callbacks
will leak due to a circular `Arc` reference when the `Notifier` is
`drop`'d.

Because `Notifier`s are rarely `drop`'d in production this isn't a
huge deal, but shows up materially in bindings tests as they spawn
many nodes over the course of a short test.

Fixes lightningdevkit#2232
@TheBlueMatt TheBlueMatt added this to the 0.0.116 milestone Apr 26, 2023
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (b734735) 91.55% compared to head (7caa584) 91.55%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2233      +/-   ##
==========================================
- Coverage   91.55%   91.55%   -0.01%     
==========================================
  Files         104      104              
  Lines       51749    51779      +30     
  Branches    51749    51779      +30     
==========================================
+ Hits        47379    47405      +26     
- Misses       4370     4374       +4     
Impacted Files Coverage Δ
lightning/src/util/wakers.rs 95.66% <100.00%> (-0.54%) ⬇️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wpaulino wpaulino merged commit d4fc1a7 into lightningdevkit:main Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sleeper leaks due to circular arcs
4 participants