-
Notifications
You must be signed in to change notification settings - Fork 113
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 poll_ready usage for the Inbound service #1620
Conversation
22cf22a
to
61849c7
Compare
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.
looks good. I left one suggestion that I'm not sure will work but that I think is worth looking into.
ae7cbdc
to
f6a8677
Compare
Uses the `ServiceExt::oneshot` design pattern from ZcashFoundation#1593.
Use `ServiceExt::oneshot` to perform state requests. Explain that `ServiceExt::call_all` calls `poll_ready` internally. Document a state service invariant imposed by `ServiceExt::call_all`.
ServiceExt::call_all leaks Tower::Buffer reservations, so we can't use it in Zebra. Instead, use a loop in the returned future. See ZcashFoundation#1593 for details.
And log an info-level message as a diagnostic, in case setup takes a long time.
This change encodes a bunch of invariants in the type system, and adds explicit failure states for: * a closed oneshot, * bugs in the initialization code.
f6a8677
to
df39910
Compare
Rather than having them default to `Ok(())`, which is incorrect for some error handlers.
@yaahc @oxarbitrage I think we're pretty close to the final version of this fix |
The windows failure is an unrelated linker error #1651 |
I'm re-running CI to test that windows passes after the latest fixes. |
You need to rebase the PR this the windows test to pass. |
GitHub runs CI on a merge commit with the latest |
The macOS testnet failure is a known issue. |
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.
Here's what we need to revert from this PR, based on the latest Buffer
/Batch
constraints in #1593.
// Correctness: | ||
// | ||
// We can't use `call_all` here, because it leaks buffer slots: | ||
// https://github.com/tower-rs/tower/blob/master/tower/src/util/call_all/common.rs#L112 |
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 comment is true, but for slightly different reasons:
call_all
can hold one buffer slot per clone for a long time- we're not sure when the returned future will complete
- we don't limit how many returned futures can be concurrently running
So we still can't use call_all
.
Motivation
The
Inbound
service misusespoll_ready
, filling up buffers, and potentially causing hangs.See #1593 for a general explanation.
Solution
Make sure each
poll_ready
is followed by acall
:ServiceExt::oneshot
pattern from Make sure Zebra uses poll_ready and Buffer reservations correctly #1593ServiceExt::call_all
usespoll_ready
internallypoll_ready
constraint due to a bug inServiceExt::call_all
The code in this pull request has:
Review
@yaahc and @oxarbitrage might want to look at this PR to see some
poll_ready
example code.Related Issues
Solves some of the hangs from #1435
Follow Up Work
Do the rest of #1593