You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by ni...@apache.org on 2024/11/22 07:17:05 UTC

(celeborn) branch main updated: [CELEBORN-1726][FOLLOWUP] Avoid NPE when transition worker state

This is an automated email from the ASF dual-hosted git repository.

nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new d722b7621 [CELEBORN-1726][FOLLOWUP] Avoid NPE when transition worker state
d722b7621 is described below

commit d722b7621db244280924097c39e2c9813fcbe241
Author: Weijie Guo <re...@163.com>
AuthorDate: Fri Nov 22 15:16:53 2024 +0800

    [CELEBORN-1726][FOLLOWUP] Avoid NPE when transition worker state
    
    ### What changes were proposed in this pull request?
    Avoid NPE when transition worker state
    
    ### Why are the changes needed?
    
    Fix test.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    No need.
    
    Closes #2938 from reswqa/fix-npe.
    
    Authored-by: Weijie Guo <re...@163.com>
    Signed-off-by: SteNicholas <pr...@163.com>
---
 .../apache/celeborn/service/deploy/worker/WorkerStatusManager.scala   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerStatusManager.scala b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerStatusManager.scala
index 1957cbfce..e31fcf576 100644
--- a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerStatusManager.scala
+++ b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/WorkerStatusManager.scala
@@ -129,7 +129,9 @@ private[celeborn] class WorkerStatusManager(conf: CelebornConf) extends Logging
     if (allowStates != null && allowStates.contains(state)) {
       logInfo(s"Worker transition status from ${currentWorkerStatus.getState} to $state.")
       currentWorkerStatus = new WorkerStatus(state.getNumber, System.currentTimeMillis())
-      worker.workerInfo.setWorkerStatus(currentWorkerStatus)
+      if (worker != null && worker.workerInfo != null) {
+        worker.workerInfo.setWorkerStatus(currentWorkerStatus)
+      }
     } else {
       logWarning(
         s"Worker transition status from ${currentWorkerStatus.getState} to $state is not allowed.")