Solr
  1. Solr
  2. SOLR-4150

NPE in distributed result grouping if group.query has no results

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: SolrCloud
    • Labels:
      None

      Description

      If group.query has no results in a distributed search, there is an NPE in the front-end:

      Dec 5, 2012 10:40:31 PM org.apache.solr.core.SolrCore execute
      INFO: [collection1] webapp=/solr path=/select params={debugQuery=true&group.ngroups=true&fl=thing,eventid&indent=true&q=thing:("CODE:20517")&group.field=eventid&group.query=thing:CODE*&group=true&wt=json&fq=source:somewhere} status=500 QTime=745 
      Dec 5, 2012 10:40:31 PM org.apache.solr.common.SolrException log
      SEVERE: null:java.lang.NullPointerException
      	at org.apache.solr.search.grouping.distributed.shardresultserializer.TopGroupsResultTransformer.transformToNative(TopGroupsResultTransformer.java:110)
      	at org.apache.solr.search.grouping.distributed.responseprocessor.TopGroupsShardResponseProcessor.process(TopGroupsShardResponseProcessor.java:80)
      	at org.apache.solr.handler.component.QueryComponent.handleGroupedResponses(QueryComponent.java:620)
      	at org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:603)
      	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:309)
      	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
      	at org.apache.solr.core.SolrCore.execute(SolrCore.java:1699)
      	at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:455)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:276)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1337)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:484)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
      	at org.eclipse.jetty.server.Server.handle(Server.java:351)
      	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
      	at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
      	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
      	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
      	at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
      	at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
      	at java.lang.Thread.run(Thread.java:662)
      

      (This is in sharding, maybe not a SolrCloud problem.)

        Issue Links

          Activity

          Hide
          Tommaso Teofili added a comment -

          fixed in 1421164 (trunk) and 1421167 (branch_4x)

          Show
          Tommaso Teofili added a comment - fixed in 1421164 (trunk) and 1421167 (branch_4x)
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Tommaso Teofili
          http://svn.apache.org/viewvc?view=revision&revision=1421167

          SOLR-4150 - merged back to branch_4x

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Tommaso Teofili http://svn.apache.org/viewvc?view=revision&revision=1421167 SOLR-4150 - merged back to branch_4x
          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Tommaso Teofili
          http://svn.apache.org/viewvc?view=revision&revision=1421164

          SOLR-4150 - added null checks (with log warnings in case of null) to TopGroupsResultTransformer#transformToNative

          Show
          Commit Tag Bot added a comment - [trunk commit] Tommaso Teofili http://svn.apache.org/viewvc?view=revision&revision=1421164 SOLR-4150 - added null checks (with log warnings in case of null) to TopGroupsResultTransformer#transformToNative
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Tommaso Teofili
          http://svn.apache.org/viewvc?view=revision&revision=1421211

          SOLR-4150 - added missing import for o.a.l.d.Document

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Tommaso Teofili http://svn.apache.org/viewvc?view=revision&revision=1421211 SOLR-4150 - added missing import for o.a.l.d.Document
          Hide
          Hoss Man added a comment -

          Tommaso: I think there is still a glitch here that we should try to address..

          In a single node, if you ask for a "group.query" that matches no documents, you get a group back that explicitly says the numFound is 0.

          But with your patch, that group is left completely out of the response.

          the attached patch has a test showing the problem

          Show
          Hoss Man added a comment - Tommaso: I think there is still a glitch here that we should try to address.. In a single node, if you ask for a "group.query" that matches no documents, you get a group back that explicitly says the numFound is 0. But with your patch, that group is left completely out of the response. the attached patch has a test showing the problem
          Hide
          Hoss Man added a comment -

          I was hoping there would be a quick fix for this, but the more i dug into the shard result merging logic for grouping, the less i understood it.

          I went ahead and commited my tests, with a workaround to ignore the comparison of the missing group.query between the single node and distributed cases – so it still demonstrates that the distributed query doesn't fail, but it ignores the fact that the responses look diff.

          I've opened SOLR-4181 to try and deal with it at a later date.

          Committed revision 1421451.
          Committed revision 1421456.

          Show
          Hoss Man added a comment - I was hoping there would be a quick fix for this, but the more i dug into the shard result merging logic for grouping, the less i understood it. I went ahead and commited my tests, with a workaround to ignore the comparison of the missing group.query between the single node and distributed cases – so it still demonstrates that the distributed query doesn't fail, but it ignores the fact that the responses look diff. I've opened SOLR-4181 to try and deal with it at a later date. Committed revision 1421451. Committed revision 1421456.
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Chris M. Hostetter
          http://svn.apache.org/viewvc?view=revision&revision=1421456

          SOLR-4150: tests for existing fix. includes workarround for SOLR-4181 (merge r1421451)

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1421456 SOLR-4150 : tests for existing fix. includes workarround for SOLR-4181 (merge r1421451)
          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Chris M. Hostetter
          http://svn.apache.org/viewvc?view=revision&revision=1421451

          SOLR-4150: tests for existing fix. includes workarround for SOLR-4181

          Show
          Commit Tag Bot added a comment - [trunk commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1421451 SOLR-4150 : tests for existing fix. includes workarround for SOLR-4181
          Hide
          Tommaso Teofili added a comment -

          thanks Hoss, I'll take a look myself too tomorrow.

          Show
          Tommaso Teofili added a comment - thanks Hoss, I'll take a look myself too tomorrow.

            People

            • Assignee:
              Tommaso Teofili
              Reporter:
              Lance Norskog
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development