Christine Poerschke created SOLR-9391:
-----------------------------------------

             Summary: LBHttpSolrClient.request can return incorrect Rsp.server 
string
                 Key: SOLR-9391
                 URL: https://issues.apache.org/jira/browse/SOLR-9391
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Christine Poerschke
            Assignee: Christine Poerschke
            Priority: Minor
         Attachments: SOLR-9391.patch

Problem:
* 
[LBHttpSolrClient.request|https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java#L361-L366]
 assigns to {{rsp.server}} at line 361 and then at line 366 makes a 
{{doRequest(client, req, rsp, isUpdate, false, null);}} method call.
* If the original {{doRequest}} call(s) did not succeed then later at [line 
382|https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java#L382]
 additional {{doRequest}} calls may happen. These calls could use a different 
server but currently {{rsp.server}} remains unchanged and thus 
[LBHttpSolrClient.request|https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java#L331]
 could return an incorrect {{Rsp.server}} string value.

Proposed fix: 
* Change the [doRequest 
method|https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrClient.java#L409-L413]
 so that it assigns {{Rsp.server}} alongside the existing {{Rsp.rsp}} 
assignment.
* Note that since the [HttpSolrClient 
constructor|https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java#L190-L199]
 trims of any trailing {{/}} from the {{baseUrl}} then the proposed fix 
potentially minutely changes the {{Rsp.getServer()}} return value.
** {{Rsp.getServer()}} is called by 
[HttpShardHandler.submit|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java#L200]
 as {{srsp.setShardAddress(rsp.getServer());}}
** I have not fully checked where/how {{getShardAddress()}} is then 
subsequently used but would very much hope that the removal of a trailing {{/}} 
would not cause any issues.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to