This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_9_9
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9_9 by this push:
     new fc7296a3dc8 SOLR-17876: Http2SolrClient: followRedirects=true flaky 
(#3505)
fc7296a3dc8 is described below

commit fc7296a3dc86394308dc7beb38a291a937b27029
Author: David Smiley <[email protected]>
AuthorDate: Mon Sep 1 00:20:46 2025 -0400

    SOLR-17876: Http2SolrClient: followRedirects=true flaky (#3505)
    
    If someone creates an Http2SolrClient with followRedirects=true, and then 
uses this client to create future clients (via builder.withHttpClient), then 
redirect processing would be disabled on the shared instance (bad).
    
    (cherry picked from commit 7301af08f90171f4e22b9fb0e019ff9163ceae28)
---
 solr/CHANGES.txt                                                     | 4 ++++
 .../src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java  | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 489b83e314b..64337e65822 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -18,6 +18,10 @@ Bug Fixes
 
 * SOLR-17871: Http2SolrClient wasn't honoring idle timeout configuration above 
30 seconds -- a regression. (Thomas Wöckinger, David Smiley)
 
+* SOLR-17876: Http2SolrClient: followRedirects=true: if Http2SolrClient was 
created with followRedirects=true,
+  and then was used to create future clients (via builder.withHttpClient), 
then redirect processing was wrongly
+  disabled on the shared instance. (David Smiley)
+
 Dependency Upgrades
 ---------------------
 (No changes)
diff --git 
a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java 
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 15c2d636a54..0529029f14a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -157,11 +157,12 @@ public class Http2SolrClient extends HttpSolrClientBase {
       this.httpClient = createHttpClient(builder);
       this.closeClient = true;
     }
+    // note: do not manipulate httpClient below this point; it could be a 
shared instance
+
     if (builder.listenerFactory != null) {
       this.listenerFactory.addAll(builder.listenerFactory);
     }
     updateDefaultMimeTypeForParser();
-    
this.httpClient.setFollowRedirects(Boolean.TRUE.equals(builder.followRedirects));
     this.idleTimeoutMillis = builder.getIdleTimeoutMillis();
 
     try {
@@ -301,7 +302,7 @@ public class Http2SolrClient extends HttpSolrClientBase {
     httpClient.setExecutor(this.executor);
     httpClient.setStrictEventOrdering(false);
     httpClient.setConnectBlocking(true);
-    httpClient.setFollowRedirects(false);
+    
httpClient.setFollowRedirects(Boolean.TRUE.equals(builder.followRedirects));
     httpClient.setMaxRequestsQueuedPerDestination(
         asyncTracker.getMaxRequestsQueuedPerDestination());
     httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, 
USER_AGENT));

Reply via email to