buffer: Move idle timeouts into the buffer#502
Merged
Conversation
The layered approach to idle timeouts does not behave well with the buffer. When the buffer's dispatch receives a request exactly as the timeout expires, it polls the inner service (and therefore the idle timeout) before polling for new requests, causing the requests to be failed with an idle error. This change removes the `idle` timeout layer, instead opting to do idle-based timeouts in the buffer directly. This allows us to poll for new requests before checking idleness, eliminating the possibility of this kind of data-race.
kleimkuhler
approved these changes
May 5, 2020
Contributor
kleimkuhler
left a comment
There was a problem hiding this comment.
Change and the tests look good!
hawkw
approved these changes
May 5, 2020
Contributor
hawkw
left a comment
There was a problem hiding this comment.
having to bind the idle timeout & buffer more tightly is kind of a shame, but the motivation and the change both make sense. this seems good to me.
i think the new code shouldn't be too difficult to translate to std::future, but note that the existing buffer impl will have changed a bit. @olix0r, once this lands, if you're planning to open a PR against master-tokio-0.2, i'd be happy to review & help out with that?
olix0r
added a commit
that referenced
this pull request
May 5, 2020
Applies the changes in #502 to the tokio-0.2 branch.
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
May 7, 2020
This release modifies Linkerd's internal buffering to avoid idling out services as a request arrives. This could cause failures for requests that are sent exactly once per minute, such as Prometheus scrapes. --- * Handle GRPC body errors (linkerd/linkerd2-proxy#493) * Set a grpc-status of UNAVAILABLE only on io errors (linkerd/linkerd2-proxy#498) * inbound: Remove unnecessary buffer (linkerd/linkerd2-proxy#501) * buffer: Move idle timeouts into the buffer (linkerd/linkerd2-proxy#502) * make: Support CARGO_TARGET for multi-arch builds (linkerd/linkerd2-proxy#497) * release: Use arch-specific paths (linkerd/linkerd2-proxy#508)
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
May 7, 2020
This release modifies Linkerd's internal buffering to avoid idling out services as a request arrives. This could cause failures for requests that are sent exactly once per minute, such as Prometheus scrapes. --- * Set a grpc-status of UNAVAILABLE only on io errors (linkerd/linkerd2-proxy#498) * inbound: Remove unnecessary buffer (linkerd/linkerd2-proxy#501) * buffer: Move idle timeouts into the buffer (linkerd/linkerd2-proxy#502) * make: Support CARGO_TARGET for multi-arch builds (linkerd/linkerd2-proxy#497) * release: Use arch-specific paths (linkerd/linkerd2-proxy#508)
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
May 7, 2020
This release modifies Linkerd's internal buffering to avoid idling out services as a request arrives. This could cause failures for requests that are sent exactly once per minute, such as Prometheus scrapes. --- * Set a grpc-status of UNAVAILABLE only on io errors (linkerd/linkerd2-proxy#498) * inbound: Remove unnecessary buffer (linkerd/linkerd2-proxy#501) * buffer: Move idle timeouts into the buffer (linkerd/linkerd2-proxy#502) * make: Support CARGO_TARGET for multi-arch builds (linkerd/linkerd2-proxy#497) * release: Use arch-specific paths (linkerd/linkerd2-proxy#508)
olix0r
added a commit
that referenced
this pull request
May 11, 2020
Applies the changes in #502 to the tokio-0.2 branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The layered approach to idle timeouts does not behave well with the
buffer. When the buffer's dispatch receives a request exactly as the
timeout expires, it polls the inner service (and therefore the idle
timeout) before polling for new requests, causing the requests to be
failed with an idle error.
This change removes the
idletimeout layer, instead opting to doidle-based timeouts in the buffer directly. This allows us to poll for
new requests before checking idleness, eliminating the possibility of
this kind of data-race.