Description
I am trying to use V2Request to invoke the config API with SolrJ. Sometimes, I see a weird NullPointerException:
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)
and the corresponding exception on the solrj client was:
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)
The code used to invoke the api was:
V2Request request = new V2Request.Builder("/c/" + collectionName + "/config").withMethod(SolrRequest.METHOD.POST).withPayload(addListenerCommand).build(); solrClient.request(request);
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.
Attachments
Attachments
Issue Links
- relates to
-
SOLR-11150 When V2Request is sent to the wrong node, it throws NPE
- Open