Chris M. Hostetter created SOLR-16425:
-----------------------------------------

             Summary: NullPointerException in SimplePlacementFactory: 
PlacementRequest.getCollection() is null
                 Key: SOLR-16425
                 URL: https://issues.apache.org/jira/browse/SOLR-16425
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Chris M. Hostetter


I noticed that both {{CloudSolrClientTest.testPerReplicaStateCollection}} and 
{{PerReplicaStatesIntegrationTest.testPerReplicaStateCollection}} have similar 
jenkins failure rates – and are written in a similar way – so i went looking at 
the logs to see if i could spot an obviously copy/pasted test bug.

What i found is that when these tests fail, they (usually) fail with an NPE in 
SimplePlacementFactory – these NPEs occur during some stream processing, and 
thanks to improvements in recent JDKs, some of the jobs from Uwe's machines 
give us the details on what is null..
{code:java}
  2> Caused by: java.lang.NullPointerException: Cannot invoke 
"org.apache.solr.cluster.SolrCollection.getName()" because the return value of 
"org.apache.solr.cluster.placement.PlacementRequest.getCollection()" is null
  2>    at 
org.apache.solr.cluster.placement.plugins.SimplePlacementFactory$SimplePlacementPlugin.lambda$computePlacements$1(SimplePlacementFactory.java:88)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot build, details omitted]]
  2>    at 
java.util.Comparator.lambda$comparingInt$7b0bb60$1(Comparator.java:494) ~[?:?]
  2>    at 
java.util.Comparator.lambda$thenComparing$36697e65$1(Comparator.java:220) ~[?:?]
  2>    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[?:?]
  2>    at java.util.TimSort.sort(TimSort.java:220) ~[?:?]
  2>    at java.util.Arrays.sort(Arrays.java:1307) ~[?:?]
  2>    at 
java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:353) ~[?:?]
  2>    at 
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[?:?]
  2>    at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) 
~[?:?]
  2>    at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) 
~[?:?]
  2>    at 
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
  2>    at 
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
  2>    at 
org.apache.solr.cluster.placement.plugins.SimplePlacementFactory$SimplePlacementPlugin.computePlacements(SimplePlacementFactory.java:91)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot build, details omitted]]
  2>    at 
org.apache.solr.cluster.placement.impl.PlacementPluginAssignStrategy.assign(PlacementPluginAssignStrategy.java:64)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot build, details omitted]]
  2>    at 
org.apache.solr.cloud.api.collections.Assign$AssignStrategy.assign(Assign.java:431)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot build, details omitted]]
  2>    at 
org.apache.solr.cloud.api.collections.CreateCollectionCmd.buildReplicaPositions(CreateCollectionCmd.java:552)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot build, details omitted]]
  2>    at 
org.apache.solr.cloud.api.collections.CreateCollectionCmd.call(CreateCollectionCmd.java:240)
 ~[solr-core-10.0.0-SNAPSHOT.jar:10.0.0-SNAPSHOT 
619a30863170f7a80c435082f2193d7297c5393c [snapshot b
{code}
...slightly diff example i found...
{code:java}
  2> Caused by: java.lang.NullPointerException: Cannot invoke 
"org.apache.solr.cluster.SolrCollection.getName()" because the return value of 
"org.apache.solr.cluster.placement.PlacementRequest.getCollection()" is null
  2>    at 
org.apache.solr.cluster.placement.plugins.SimplePlacementFactory$SimplePlacementPlugin.computePlacements(SimplePlacementFactory.java:107)
 ~[main/:?]
  2>    at 
org.apache.solr.cluster.placement.impl.PlacementPluginAssignStrategy.assign(PlacementPluginAssignStrategy.java:74)
 ~[main/:?]
  2>    at 
org.apache.solr.cloud.api.collections.Assign$AssignStrategy.assign(Assign.java:432)
 ~[main/:?]
  2>    at 
org.apache.solr.cloud.api.collections.CreateCollectionCmd.buildReplicaPositions(CreateCollectionCmd.java:552)
 ~[main/:?]
  2>    at 
org.apache.solr.cloud.api.collections.CreateCollectionCmd.call(CreateCollectionCmd.java:240)
 ~[main/:?]
{code}
I haven't done an exhaustive search, but these specific errors (NPE rooted in 
{{the return value of 
"org.apache.solr.cluster.placement.PlacementRequest.getCollection()" is null}} 
) pop up in multiple {{PerReplicaStatesIntegrationTest.test*}} methods, as well 
as at least one occurrence in 
{{CreateCollectionCleanupTest.testAsyncCreateCollectionCleanup}}

(FYI: I have no idea _why_ {{PlacementRequest.getCollection()}} is sometimes 
null – but I wanted to put this out there in the hopes that people more 
familiar with the code then I am can take a stab at this)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to