You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by zu...@apache.org on 2023/12/13 06:09:58 UTC

(incubator-uniffle) branch master updated: [MINOR] fix(spark): Fix NPE for ShuffleWriteClientImpl.unregisterShuffle (#1367)

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

zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new f17e060bc [MINOR] fix(spark): Fix NPE for ShuffleWriteClientImpl.unregisterShuffle (#1367)
f17e060bc is described below

commit f17e060bc2ecf9ad7b8f17562f4cad6ffe66321f
Author: Zhen Wang <64...@qq.com>
AuthorDate: Wed Dec 13 14:09:53 2023 +0800

    [MINOR] fix(spark): Fix NPE for ShuffleWriteClientImpl.unregisterShuffle (#1367)
    
    ### What changes were proposed in this pull request?
    
    Fix NPE for ShuffleWriteClientImpl.unregisterShuffle.
    
    ### Why are the changes needed?
    
    Since the `id` of `RssShuffleManager` in Executor is assigned in `getWriter`, this means that the `id` may be null before `getWriter`, so this may cause NPE to occur in `ShuffleWriteClientImpl.unregisterShuffle`.
    
    error log:
    
    ```
    23/12/12 14:25:47 ERROR RssShuffleManager: Errors on closing shuffle write client
    java.lang.NullPointerException
            at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
            at org.apache.uniffle.client.impl.ShuffleWriteClientImpl.unregisterShuffle(ShuffleWriteClientImpl.java:751)
            at org.apache.spark.shuffle.RssShuffleManager.stop(RssShuffleManager.java:591)
            at org.apache.spark.SparkEnv.stop(SparkEnv.scala:90)
            at org.apache.spark.executor.Executor.stop(Executor.scala:335)
            at org.apache.spark.executor.CoarseGrainedExecutorBackend$$anonfun$receive$1$$anon$1.run(CoarseGrainedExecutorBackend.scala:203)
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
---
 .../java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java b/client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java
index 4f01c6de6..6ad33e026 100644
--- a/client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java
+++ b/client/src/main/java/org/apache/uniffle/client/impl/ShuffleWriteClientImpl.java
@@ -1015,6 +1015,9 @@ public class ShuffleWriteClientImpl implements ShuffleWriteClient {
 
   @Override
   public void unregisterShuffle(String appId) {
+    if (appId == null) {
+      return;
+    }
     Map<Integer, Set<ShuffleServerInfo>> appServerMap = shuffleServerInfoMap.get(appId);
     if (appServerMap == null) {
       return;