-
Notifications
You must be signed in to change notification settings - Fork 846
SOLR-17433: Set default http request timeout to infinite #4626
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
base: main
Are you sure you want to change the base?
Changes from all commits
0a475cf
08359ce
bca4e41
739f3e9
206d1df
898166d
52bad08
e5c4d0b
99fe3d1
f91fc5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| title: > | ||
| SolrClients no longer have a default request timeout. It was problematic with streaming expressions. | ||
| The idle timeout remains, albeit the JDK HttpClient doesn't support that (has none). | ||
| type: changed | ||
| authors: | ||
| - name: Vishnu Priya Chandra Sekar | ||
| links: | ||
| - name: SOLR-17433 | ||
| url: https://issues.apache.org/jira/browse/SOLR-17433 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,11 @@ public HttpSolrClient solrClient(Integer overrideIdleTimeoutMs) { | |
| var builder = | ||
| new HttpJdkSolrClient.Builder().withSSLContext(MockTrustManager.ALL_TRUSTING_SSL_CONTEXT); | ||
| if (overrideIdleTimeoutMs != null) { | ||
| builder.withIdleTimeout(overrideIdleTimeoutMs, TimeUnit.MILLISECONDS); | ||
| builder | ||
| .withIdleTimeout(overrideIdleTimeoutMs, TimeUnit.MILLISECONDS) | ||
| // override the infinite request timeout with idle timeout to ensure idle requests times | ||
| // out. | ||
| .withRequestTimeout(overrideIdleTimeoutMs, TimeUnit.MILLISECONDS); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably just be 0, infinite?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default the request timeout is infinite which causes the test to hang forever. Thus, I had to change it to a definite value. |
||
| } | ||
| return builder.build(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -405,6 +405,9 @@ private class TimeoutZombieTestContext implements AutoCloseable { | |
| new HttpJettySolrClient.Builder() | ||
| .withConnectionTimeout(1000, TimeUnit.MILLISECONDS) | ||
| .withIdleTimeout(1, TimeUnit.MILLISECONDS) | ||
| // override the infinite request timeout with idle timeout to ensure idle requests | ||
| // times out. | ||
|
Comment on lines
+408
to
+409
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. something seems suspicious... the idle timeout should work if the request timeout is infinite. They are different things; idle refers to the longest period of not receiving any data at all from the server. The request timeout is an overall timeout for the entire request.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idle timeout is ineffective for this test. The http client (through Jetty) uses HTTP2 protocol to communicate with the server. After establishing connection with the server, it tries to send the request headers to the server as part of creating HTTP streams. However, the fake server fails to ack the headers.
I was wondering how the test worked before. It looks like the test wanted to simulate socket timeout, however it was not happening. The HTTP request was timing out because of request timeout (previously it took idle timeout as default value.) In order to fix the test, either the fake server must ack the header (Gemini says it is possible however I haven't tried first hand) or simulate request timeout instead. Let me know which one choose Thanks to the Jetty logs [3] for helping me to understand this. [1] https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/internal/HttpSenderOverHTTP2.java#L203
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RE "this test": LB2SolrClientTest is a test suite with a number of tests, and this comment thread is on a general part of the test suite. Hopefully the "connect" timeout ones are valid; yes? So I suppose your input is that the "testTimeoutExceptionMarksServerAsZombie" test and Async one are flawed? If the default idle timeout of -1 is actually used as such for the first response, even in the beginning... this is a problem IMO. If we have the intended/desired idle timeout then we can use that. If we don't, I suppose the connection timeout would be a reasonable substitute.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@dsmiley The issue only affects After digging into the code, it looks like the difference is that the synchronous API waits for the response headers using The async API, on the other hand, doesn't have an equivalent application-layer timeout and instead relies on the transport layer to trigger [1] https://github.com/apache/solr/blob/main/solr/solrj-jetty/src/java/org/apache/solr/client/solrj/jetty/HttpJettySolrClient.java#L484
Maybe we should a have timeout at the application layer like the sync call ? (Not sure whether it is the right PR to fix the async call as it seem to be a different problem) Apologizes, if my findings weren't complete earlier. I found it hard to debug as the timeout was triggered at different layer based on the request and also tracing Java futures was hard. I hope now it make sense.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, it makes sense to set the idle timeout to a definite value. The problem will be solved without needing to add timeout to the futures that handles async request. |
||
| .withRequestTimeout(1, TimeUnit.MILLISECONDS) | ||
| .build(); | ||
|
|
||
| lbClient = new LBJettySolrClient.Builder(delegateClient, nonRoutableEndpoint).build(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.