Shalin Shekhar Mangar created SOLR-11130:
--------------------------------------------

             Summary: SolrJ routes V2Request to wrong nodes and such nodes are 
not able to forward these requests correctly
                 Key: SOLR-11130
                 URL: https://issues.apache.org/jira/browse/SOLR-11130
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: SolrJ, v2 API
    Affects Versions: 6.6, master (8.0)
            Reporter: Shalin Shekhar Mangar


I am trying to use V2Request to invoke the config API with SolrJ. Sometimes, I 
see a weird NullPointerException:

{code}
5396 ERROR (qtp1277924867-37) [n:127.0.0.1:33527_solr    ] o.a.s.s.HttpSolrCall 
null:java.lang.NullPointerException
        at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:518)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:378)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:322)
{code}
and the corresponding exception on the solrj client was:
{code}
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteExecutionException: 
Error from server at http://127.0.0.1:33527/solr: Unknown Error

        at 
__randomizedtesting.SeedInfo.seed([33AAA14CC3DE7EE3:BBFE9E966D22131B]:0)
        at 
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteExecutionException.create(HttpSolrClient.java:812)
        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:602)
        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:252)
        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:241)
        at 
org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:483)
        at 
org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:413)
        at 
org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1121)
        at 
org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:862)
        at 
org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:793)
        at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219)
        at 
org.apache.solr.cloud.TestCloudSearcherWarming.test(TestCloudSearcherWarming.java:68)
{code}

The code used to invoke the api was:
{code}
V2Request request = new V2Request.Builder("/c/" + collectionName + 
"/config").withMethod(SolrRequest.METHOD.POST).withPayload(addListenerCommand).build();
    solrClient.request(request);
{code}

This exception happens when the config API call is sent to a Solr node which 
does not have any replica for the collection. Now in v1 API, solrj would refuse 
to send the request and complain that no default collection is set but the 
V2Request does not do that.

So there are two bugs here:
# V2Request tries to send request for collection X to a random node without 
caring for correct routing
# The node receiving such request is not able to forward it to the right node 
and fails with a NPE.

To solve 1, our options are:
# Either we start requiring the same for V2 i.e. user must set default 
collection
# We detect that users are trying to invoke a collection specific v2 api and we 
add a new method in V2RequestBuilder to specify a collection name and ensure 
that the user calls it.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to