Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13195

NPE caused by distributed queries when no shards are configured

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: main (9.0)
    • Fix Version/s: None
    • Component/s: FacetComponent
    • Labels:
    • Environment:

      Description

      Requesting the following URL causes Solr to return an HTTP 500 error response:

      http://localhost:8983/solr/films/select?distrib=true&facet=on&facet.field=genre
      

      The error response seems to be caused by the following uncaught exception:

      null:java.lang.NullPointerException
      at org.apache.solr.handler.component.FacetComponent$DistribFieldFacet.<init>(FacetComponent.java:1432)
      at org.apache.solr.handler.component.FacetComponent$FacetInfo.parse(FacetComponent.java:1266)
      at org.apache.solr.handler.component.FacetComponent.modifyRequest(FacetComponent.java:528)
      at org.apache.solr.handler.component.ResponseBuilder.addRequest(ResponseBuilder.java:162)
      at org.apache.solr.handler.component.QueryComponent.createMainQuery(QueryComponent.java:755)
      at org.apache.solr.handler.component.QueryComponent.regularDistributedProcess(QueryComponent.java:546)
      at org.apache.solr.handler.component.QueryComponent.distributedProcess(QueryComponent.java:499)
      at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:348)
      

      Since the query contains “distrib=true”, it is handled by calling the distributedProcess methods of the search pipeline. At no point in the call chain that leads to the above exception is there any check if the ResponseBuilder rb used to handle the request actually has its shared property configured. Nevertheless, the DistribFieldFact constructor tries to access rb.shards.length, but rb.shared is null in this example.

      We found this bug using Diffblue Microservices Testing. Find more information on this fuzz testing campaign.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jkloos Johannes Kloos
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m