-
Notifications
You must be signed in to change notification settings - Fork 25k
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 Watcher HTTP connection config for longevity #72736
Fix Watcher HTTP connection config for longevity #72736
Conversation
Watcher uses a connection pool for outgoing HTTP traffic, which means that some HTTP connections may live for a long time, possibly in an idle state. Such connections may be silently torn down by a remote device, so that when we re-use them we encounter a `Connection reset` or similar error. This commit introduces a setting allowing users to set a finite expiry time on these connections, and also enables TCP keepalives on them by default so that a remote teardown will be actively detected sooner. Closes elastic#52997
Pinging @elastic/es-core-features (Team:Core/Features) |
@@ -770,6 +770,50 @@ public void testCreateUri() throws Exception { | |||
assertCreateUri("https://example.org", ""); | |||
} | |||
|
|||
public void testConnectionReuse() throws Exception { |
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 was the least flaky way I could think of to test this but it's not exactly watertight, we cannot 100% guarantee that the connection will be re-used in the first case, nor can we guarantee that the client port won't be re-used in the second case.
I also couldn't work out a way to test that TCP keepalives are enabled at all.
@elasticmachine please run elasticsearch-ci/2 |
@elasticmachine update branch |
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.
Thanks David, these changes look good and is much better then current workaround of sending a connection closed header to force non-persistent connections.
Watcher uses a connection pool for outgoing HTTP traffic, which means that some HTTP connections may live for a long time, possibly in an idle state. Such connections may be silently torn down by a remote device, so that when we re-use them we encounter a `Connection reset` or similar error. This commit introduces a setting allowing users to set a finite expiry time on these connections, and also enables TCP keepalives on them by default so that a remote teardown will be actively detected sooner. Closes #52997
Watcher uses a connection pool for outgoing HTTP traffic, which means
that some HTTP connections may live for a long time, possibly in an idle
state. Such connections may be silently torn down by a remote device, so
that when we re-use them we encounter a
Connection reset
or similarerror.
This commit introduces a setting allowing users to set a finite expiry
time on these connections, and also enables TCP keepalives on them by
default so that a remote teardown will be actively detected sooner.
Closes #52997