Skip to content

Apache Lucene open-source search software

SOLR-6941: DistributedQueue#containsTaskWithRequestId can fail with NPE.

Mark Robert Miller423e469e5f73
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d21e62f3271..2bfc3e29a8c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -435,6 +435,8 @@ Bug Fixes
* SOLR-6923: AutoAddReplicas also consults live_nodes to see if a state change has happened.
(Varun Thacker via Anshum Gupta)
+* SOLR-6941: DistributedQueue#containsTaskWithRequestId can fail with NPE. (Mark Miller)
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java b/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
index 1972015b3bd..99d7769bd67 100644
--- a/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
+++ b/solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java
@@ -122,10 +122,13 @@ public class DistributedQueue {
for (String childName : childNames) {
if (childName != null) {
try {
- ZkNodeProps message = ZkNodeProps.load(zookeeper.getData(dir + "/" + childName, null, null, true));
- if (message.containsKey(OverseerCollectionProcessor.ASYNC)) {
- LOG.info(">>>> {}", message.get(OverseerCollectionProcessor.ASYNC));
- if(message.get(OverseerCollectionProcessor.ASYNC).equals(requestId)) return true;
+ byte[] data = zookeeper.getData(dir + "/" + childName, null, null, true);
+ if (data != null) {
+ ZkNodeProps message = ZkNodeProps.load(data);
+ if (message.containsKey(OverseerCollectionProcessor.ASYNC)) {
+ LOG.debug(">>>> {}", message.get(OverseerCollectionProcessor.ASYNC));
+ if(message.get(OverseerCollectionProcessor.ASYNC).equals(requestId)) return true;
+ }
}
} catch (KeeperException.NoNodeException e) {
// Another client removed the node first, try next