jihoonson 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_r404395190
 
 

 ##########
 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 
from event.getData() so I just let NPE happens and the catch will take care of 
logging and making sure the JVM doesnt shutdown.
   
   `even.getData()` can be null depending on the event type; it must not be 
null for `CHILD_ADDED`, `CHILD_UPDATED`, and `CHILD_REMOVED` events. It should 
be null otherwise. I think it's worth checking null depending on the event type.

----------------------------------------------------------------
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