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

Three NullPointerExceptions in org.apache.solr.search.JoinQuery.hashCode()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 9.0
    • None
    • None

    Description

      Requesting any of the following URLs causes Solr to return an HTTP 500 error response:

      http://localhost:8983/solr/films/select?fq={!join%20from=b%20to=a}
      http://localhost:8983/solr/films/select?fq={!join%20to=a}
      http://localhost:8983/solr/films/select?fq={!join}
      

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

      java.lang.NullPointerException
       at org.apache.solr.search.JoinQuery.hashCode(JoinQParserPlugin.java:578)
       at org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:52)
       at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1328)
       at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:567)
       at org.apache.solr.handler.component.QueryComponent.doProcessUngroupedSearch(QueryComponent.java:1434)
       at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:373)
       at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:298)
       at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2559)
      [...]
      

      The problem seems to be related with method hasCode in the class org.apache.solr.search.JoinQuery:

        @Override
        public int hashCode() {
          int h = classHash();
          h = h * 31 + fromField.hashCode();
          h = h * 31 + toField.hashCode();
          h = h * 31 + q.hashCode();
          h = h * 31 + Objects.hashCode(fromIndex);
          h = h * 31 + (int) fromCoreOpenTime;
          return h;
        }
      

      The URLs provided above selectively leave uninitialized the fields fromField, fromIndex, q, and toField, but all of these fields are accessed by this method.
       
      We found this issue and ~70 more like this using Diffblue Microservices Testing. Find more information on this fuzz testing campaign.

      Attachments

        1. SOLR-13202.patch
          0.9 kB
          Pranay Kumar Chaudhary
        2. home.zip
          376 kB
          Cesar Rodriguez

        Activity

          People

            Unassigned Unassigned
            cesar.rodriguez Cesar Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: