-
Notifications
You must be signed in to change notification settings - Fork 423
Bias Selector to first poll the sleeper future
#4259
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
Bias Selector to first poll the sleeper future
#4259
Conversation
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4259 +/- ##
=======================================
Coverage 89.33% 89.34%
=======================================
Files 180 180
Lines 139042 139042
Branches 139042 139042
=======================================
+ Hits 124219 124225 +6
- Misses 12196 12200 +4
+ Partials 2627 2617 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Did you experience this somewhere? Seems somewhat surprising that we'd have that much to process in the other futures. |
We got user reports regarding LDK Node timing out on trying to shutdown the background processor. While we still have to better understand why we would keep processing events, AFAICT the biased selector would likely have allowed us to exit the event processing loop nonetheless. Btw, we recently started doing the essentially same thing in LDK Node by using |
|
Hmm, yea, seems like it might be worth digging into that. I don't think any of the futures being polled should complete instantly unless event handling is actually slower than events are coming in. I think the ldk-node sleeper correctly returns early if it wants to exit rather than waiting, so its also not that. That said, I don't see a problem in biasing towards the sleeper, but please move it to A rather than biasing towards E, which just seems weird? |
Yup, unfortunately it's a bit unclear what happened as the event processing task just hung without any log output.
Of course, now pushed fixup that moves the sleeper to |
|
Feel free to squash. |
Previously, `lightning-background-processor`'s `Selector` would poll all other futures *before* finally polling the sleeper and returning the `exit` flag if it's ready. This could lead to scenarios where we infinitely keep processing background events and never respect the `exit` flag, as long as any of other futures keep being ready. Here, we instead bias the `Selector` to always *first* poll the sleeper future, and hence have us act on the `exit` flag immediately if is set.
2557d1e to
9c0ca26
Compare
Squashed without further changes. |
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
Previously,
lightning-background-processor'sSelectorwould poll all other futures before finally polling the sleeper and returning theexitflag if it's ready. This could lead to scenarios where we infinitely keep processing background events and never respect theexitflag, as long as any of other futures keep being ready.Here, we instead bias the
Selectorto always first poll the sleeper future, and hence have us act on theexitflag immediately if is set.