maytasm commented on a change in pull request #9610: Fix NPE in 
RemoteTaskRunner event handler causes JVM shutdown
URL: https://github.com/apache/druid/pull/9610#discussion_r403436420
 
 

 ##########
 File path: 
indexing-service/src/main/java/org/apache/druid/indexing/overlord/RemoteTaskRunner.java
 ##########
 @@ -1081,6 +979,117 @@ private boolean cancelWorkerCleanup(String workerHost)
     }
   }
 
+  @VisibleForTesting
+  PathChildrenCacheListener getStatusListener(final Worker worker, final 
ZkWorker zkWorker, final SettableFuture<ZkWorker> retVal)
+  {
+    return (client, event) -> {
+      final String taskId;
+      final RemoteTaskRunnerWorkItem taskRunnerWorkItem;
+      synchronized (statusLock) {
+        try {
+          switch (event.getType()) { // lgtm 
[java/dereferenced-value-may-be-null]
+            case CHILD_ADDED:
+            case CHILD_UPDATED:
+              taskId = ZKPaths.getNodeFromPath(event.getData().getPath()); // 
lgtm [java/dereferenced-value-may-be-null]
 
 Review comment:
   Yes. event.getData() can be null here and everywhere else in this function. 
I dont think we need to do anything differently in handling the null event so I 
just let NPE happens and the catch will take care of logging and making sure 
the JVM doesnt shutdown. You can deduce that the NPE from event.getData() 
happens from the data map of the alert

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to