Skip to content

SOLR-18312: introduce dedicated thread pool executor for httpClientBu…#4655

Open
renatoh wants to merge 1 commit into
apache:mainfrom
renatoh:SOLR-18312-fix-Thread-Pool-Starvation-in-HttpJdkSolrClient
Open

SOLR-18312: introduce dedicated thread pool executor for httpClientBu…#4655
renatoh wants to merge 1 commit into
apache:mainfrom
renatoh:SOLR-18312-fix-Thread-Pool-Starvation-in-HttpJdkSolrClient

Conversation

@renatoh

@renatoh renatoh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 httpClientExecutor that is always owned and shut down by HttpJdkSolrClient, instead of reusing the request-body streaming executor.
  • Add a concurrency regression test that issues multiple concurrent JsonQueryRequest calls 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants