You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Panagiotis Bailis <pm...@gmail.com> on 2021/10/20 09:51:29 UTC

NPE in FacetModule when refine=true and a shard is down

Hello all,

We were recently testing Solr's partial results functionality (i.e. return
partial results even when some shards for a collection are down) and a
scenario where we were using the shards.tolerant=true parameter along with
a json facet request with refine=true failed with the following NPE:

x:test_collection_202110121841_shard4_replica_n6]
> o.a.s.h.RequestHandlerBase java.lang.NullPointerException  at
> org.apache.solr.search.facet.FacetMerger$Context.setShard(FacetMerger.java:65)
>  at
> org.apache.solr.search.facet.FacetModule.distributedProcess(FacetModule.java:192)
>  at
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:425)
>  at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216)
>  at
> org.apache.solr.core.SolrCore.execute(SolrCore.java:2637)
> .....



Steps to reproduce:
* Setup Solr with >=2 shards and >= 2 nodes for a collection
* Index some documents making sure that both nodes contain data
* Stop one of the nodes
* Perform the following query through Solr admin:

shards.tolerant=true&distrib=true&json.facet={"test":{"type":"terms",
> "field":"SOME_FIELD", "limit":-1, "refine": true}}


Looking at the offending line, it seems that the *rb.shards *array in
FacetModule#distributedProcess contains empty strings for the non-available
shards, which later raises an NPE when trying to unbox a null value to an
int in FacetMerge#setShard.

Something similar has already been handled in SOLR-11009 (where while the
ticket is open, the changes from the patch seem to be committed). Is there
a configuration that we're missing, or is this something that needs to be
handled in *FacetModule*?

Thank you in advance!

Regards,
- Panagiotis Bailis