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

NPE in QueryComponent.mergeIds when using timeAllowed and sorting

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 7.7.3, 8.6.3, 9.0, 8.8.1, 8.8.2
    • 9.0, 8.10
    • SolrCloud
    • None

    Description

      Only tested on 7.7.3 and master, but the offending code hasn't been changed for a while, so this presumably affects other versions as well.

      Steps to reproduce:

      1. SolrCloud
      2. Create a query which is complex enough to take a while
      3. Add a sort clause to the query (e.g. &sort=creationTimestamp asc)
      4. Add a short value timeAllowed (10ms in my test)

      Result: NPE in QueryComponent.mergeIds:935

      It may take a couple of attempts to hit the error.

      Offending code:

              NamedList sortFieldValues = (NamedList)(srsp.getSolrResponse().getResponse().get("sort_values"));
              if (sortFieldValues.size()==0 && // we bypass merging this response only if it's partial itself
                                  thisResponseIsPartial) { // but not the previous one!!
                continue; //fsv timeout yields empty sort_vlaues
              }
      

      sortFieldValues can apparently be null in some cases, depending on when the query hits the timeAllowed. Adding an extra null check fixes the issue.

              NamedList sortFieldValues = (NamedList)(srsp.getSolrResponse().getResponse().get("sort_values"));
              if ((null == sortFieldValues || sortFieldValues.size()==0) && // we bypass merging this response only if it's partial itself
                                  thisResponseIsPartial) { // but not the previous one!!
                continue; //fsv timeout yields empty sort_vlaues
              }
      

      I'll attach a patch.

      Attachments

        1. SOLR-14758.patch
          1 kB
          Bram VD
        2. SOLR-14758.patch
          4 kB
          Bram VD

        Issue Links

          Activity

            People

              uschindler Uwe Schindler
              bvd Bram VD
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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