SOLR-18312: introduce dedicated thread pool executor for httpClientBu…#4655
Open
renatoh wants to merge 1 commit into
Open
SOLR-18312: introduce dedicated thread pool executor for httpClientBu…#4655renatoh wants to merge 1 commit into
renatoh wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR (SOLR-18312) updates HttpJdkSolrClient to use a dedicated executor for the JDK HttpClient, aiming to prevent deadlocks when request bodies are streamed (producer) while the JDK client consumes them (consumer), particularly under HTTP/1.1 with concurrent requests.
Changes:
- Introduce a separate
httpClientExecutorthat is always owned and shut down byHttpJdkSolrClient, instead of reusing the request-body streaming executor. - Add a concurrency regression test that issues multiple concurrent
JsonQueryRequestcalls with large streamed bodies while forcing HTTP/1.1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java | Adds a dedicated executor for the underlying JDK HttpClient and ensures it is shut down on close. |
| solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java | Adds a concurrent, streamed-body test intended to catch deadlocks under HTTP/1.1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+655
to
+660
| () -> { | ||
| JsonQueryRequest q = buildLargeBodyQuery(); | ||
| try { | ||
| q.process(client); | ||
| } catch (Exception ignored) { | ||
| } |
Comment on lines
+664
to
+665
| CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0])) | ||
| .get(45, TimeUnit.SECONDS); |
Comment on lines
+129
to
+137
| this.httpClientExecutor = | ||
| new ExecutorUtil.MDCAwareThreadPoolExecutor( | ||
| 0, | ||
| Integer.MAX_VALUE, | ||
| 60, | ||
| TimeUnit.SECONDS, | ||
| new SynchronousQueue<>(), | ||
| new SolrNamedThreadFactory(this.getClass().getSimpleName() + "-http")); | ||
| httpClientBuilder.executor(this.httpClientExecutor); |
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.
see ticket https://issues.apache.org/jira/browse/SOLR-18312