Yuki Yano created SOLR-11009:
--------------------------------

             Summary: FacetModule throws NullPointerException when all shard 
requests fail with shards.tolerant=true
                 Key: SOLR-11009
                 URL: https://issues.apache.org/jira/browse/SOLR-11009
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Facet Module
    Affects Versions: 6.6
            Reporter: Yuki Yano


FacetModule uses FacetMerger.Context for preserving the information of shards 
during the distributed search. This context is created as null first, and will 
be initialized when the first response is returned from one of shards.
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java#L280

If shards.tolerant=true is set as the request, this initializing code may not 
be called if shard returns some errors. Therefore, if all shards fail to get 
results, the context will remain null.
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java#L275

After that, in the STAGE_GET_FIELDS phase, FacetModule checks if there are any 
refinements possible by using the context. Unfortunately, because the context 
can be null as noted above, this check may end with NullPointerException.
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java#L183

You can reproduced this error by following steps.
1. set socketTimeout of shardHandlerFactory to very short (for example, 10ms).
2. do facet search with shards.tolerant=true

The solution is very simple, just add null check before touching the context.



--
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