Hi,
I’m Facing a issue with expand component when working alongside with elevate 
component,
In some of the request (not for all request) expand component is throwing NPE 
below is the stacktrace,any idea why the ArrayTimSorter object is null and any 
way to avoid that

Solr Log stack trace-
2018-02-21 05:09:06.404 ERROR (qtp444920847-16) [c:test s:shard1 r:core_node1 
x:test_shard1_replica1] o.a.s.s.HttpSolrCall null:java.io.IOException: 
java.lang.NullPointerException
        at 
org.apache.solr.handler.component.ExpandComponent.process(ExpandComponent.java:339)
        at 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:304)
        at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)
        at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)
        at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)
        at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
        at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
        at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
        at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
        at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
        at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
        at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
        at 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at 
org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
        at org.eclipse.jetty.server.Server.handle(Server.java:534)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
        at 
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
        at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
        at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
        at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
        at 
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at 
java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:52)
        at 
java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:47)
        at org.apache.lucene.util.ArrayTimSorter.compare(ArrayTimSorter.java:48)
        at org.apache.lucene.util.Sorter.comparePivot(Sorter.java:50)
        at org.apache.lucene.util.Sorter.binarySort(Sorter.java:197)
        at org.apache.lucene.util.TimSorter.nextRun(TimSorter.java:120)
        at org.apache.lucene.util.TimSorter.sort(TimSorter.java:201)
        at org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:426)
        at org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:445)
        at org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:453)
        at 
org.apache.lucene.search.TermInSetQuery.<init>(TermInSetQuery.java:87)
        at 
org.apache.lucene.search.TermInSetQuery.<init>(TermInSetQuery.java:109)
        at 
org.apache.solr.handler.component.ExpandComponent.getGroupQuery(ExpandComponent.java:718)
        at 
org.apache.solr.handler.component.ExpandComponent.process(ExpandComponent.java:337)
        ... 34 more

Response stack trace-
java.io.IOException: java.lang.NullPointerException\n\tat 
org.apache.solr.handler.component.ExpandComponent.process(ExpandComponent.java:339)\n\tat
 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:296)\n\tat
 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)\n\tat
 org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)\n\tat 
org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)\n\tat 
org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)\n\tat 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)\n\tat
 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\n\tat
 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\n\tat
 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)\n\tat 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\n\tat
 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\n\tat
 
org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\n\tat
 org.eclipse.jetty.server.Server.handle(Server.java:534)\n\tat 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)\n\tat 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)\n\tat
 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\n\tat
 org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\n\tat 
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\n\tat
 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)\n\tat
 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)\n\tat
 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)\n\tat
 java.lang.Thread.run(Thread.java:745)\nCaused by: 
java.lang.NullPointerException\n\tat 
java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:52)\n\tat 
java.util.Comparators$NaturalOrderComparator.compare(Comparators.java:47)\n\tat 
org.apache.lucene.util.ArrayTimSorter.compare(ArrayTimSorter.java:48)\n\tat 
org.apache.lucene.util.Sorter.comparePivot(Sorter.java:50)\n\tat 
org.apache.lucene.util.Sorter.binarySort(Sorter.java:197)\n\tat 
org.apache.lucene.util.TimSorter.nextRun(TimSorter.java:120)\n\tat 
org.apache.lucene.util.TimSorter.sort(TimSorter.java:201)\n\tat 
org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:426)\n\tat 
org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:445)\n\tat 
org.apache.lucene.util.ArrayUtil.timSort(ArrayUtil.java:453)\n\tat 
org.apache.lucene.search.TermInSetQuery.<init>(TermInSetQuery.java:87)\n\tat 
org.apache.lucene.search.TermInSetQuery.<init>(TermInSetQuery.java:109)\n\tat 
org.apache.solr.handler.component.ExpandComponent.getGroupQuery(ExpandComponent.java:718)\n\tat
 
org.apache.solr.handler.component.ExpandComponent.process(ExpandComponent.java:337)\n\t...
 34 more\n


Solr version 6.6.0
Sample query 
-http://localhost:8983/solr/test/browse?fl=id,level1Id&fq=%7B!collapse+field%3Dlevel1Id+sort%3D%27merchantScore+desc%27%7D&fq=published:1&fq=salesCatalogCategoryCount:%5B1+TO+*%5D&sort=isInStock+desc,buyable+desc,score+desc,popularity+desc&rows=24&q=galaxy&forceElevation=false&enableElevation=true&elevateIds=TOQ-16110-00001-00001,TOS-15760-00008-00001,TOS-15760-00009-00001,TH7-15641-00004-00001,TOA-15628-00002-00001,TOA-15629-00056-00001,TOA-15630-00001-00001,TOA-15631-00002-00001,TOA-15632-00005-00001,TOA-15632-00039-00001,TOA-15633-00001-00001&wt=json&expand=true
 
<http://localhost:8983/solr/test/browse?fl=id,level1Id&fq={!collapse+field=level1Id+sort=%27merchantScore+desc%27}&fq=published:1&fq=salesCatalogCategoryCount:[1+TO+*]&sort=isInStock+desc,buyable+desc,score+desc,popularity+desc&rows=24&q=galaxy&forceElevation=false&enableElevation=true&elevateIds=TOQ-16110-00001-00001,TOS-15760-00008-00001,TOS-15760-00009-00001,TH7-15641-00004-00001,TOA-15628-00002-00001,TOA-15629-00056-00001,TOA-15630-00001-00001,TOA-15631-00002-00001,TOA-15632-00005-00001,TOA-15632-00039-00001,TOA-15633-00001-00001&wt=json&expand=true>

Note:- if i remove some of the ids it starts working ,and issue is not coming 
for all the queries.

Regards,
Aman Deep Singh

Reply via email to