Update keepalive timeout with Router 2.0 settings #190
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.
Router 2.0 introduced keepalive support. It will close connections idle after 90 seconds https://devcenter.heroku.com/articles/http-routing#keepalives. We want to avoid a situation where they send a request right before puma closes the connection. We can do that by setting it to the same timeout the router uses + some value (such as 5 seconds).
This timeout is used in the reactor when buffering unfinished request bodies and waiting for new requests on a still open client connection. If a connection is closed incorrectly and doesn't send a TCP
FINthis timeout will prevent puma holding onto that connection forever.There is currently a problem in puma 6x and prior with keepalives that causes high request variance puma/puma#3487. So it's recommended that puma users disable keepalive connections by until that problem is fixed upstream:
GUS-W-19166166