Skip to content

buffer: Move idle timeouts into the buffer#502

Merged
olix0r merged 4 commits intomasterfrom
ver/idle-buffer
May 5, 2020
Merged

buffer: Move idle timeouts into the buffer#502
olix0r merged 4 commits intomasterfrom
ver/idle-buffer

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented May 4, 2020

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.

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.
@olix0r olix0r requested a review from a team May 4, 2020 19:28
@olix0r olix0r self-assigned this May 4, 2020
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change and the tests look good!

Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 olix0r merged commit 96984db into master May 5, 2020
@olix0r olix0r deleted the ver/idle-buffer branch May 5, 2020 15:15
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.
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.

3 participants