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/uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 61e47b30f [#2672] fix(server):  NPE in 
PartitionedShuffleBlockIdManager (#2690)
61e47b30f is described below

commit 61e47b30fe1e86598125684fdf515bd239305655
Author: KCH <[email protected]>
AuthorDate: Wed Dec 3 11:13:23 2025 +0900

    [#2672] fix(server):  NPE in PartitionedShuffleBlockIdManager (#2690)
    
    ### What changes were proposed in this pull request?
    
    Added null checks to prevent NullPointerException in 
PartitionedShuffleBlockIdManager.getFinishedBlockIds():
    
    Add null check for partitionToBlockId when shuffleId doesn't exist
    Add null check for bitmap before calling or() method
    
    ### Why are the changes needed?
    
    Fix: #2672
    
    The method was throwing NullPointerException when:
    
    shuffleId data doesn't exist in the map
    bitmap is null for a specific partition
    These defensive checks prevent the exception and gracefully handle edge 
cases.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    UT
---
 .../server/block/PartitionedShuffleBlockIdManager.java     | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/uniffle/server/block/PartitionedShuffleBlockIdManager.java
 
b/server/src/main/java/org/apache/uniffle/server/block/PartitionedShuffleBlockIdManager.java
index c7d9f2657..543b167ae 100644
--- 
a/server/src/main/java/org/apache/uniffle/server/block/PartitionedShuffleBlockIdManager.java
+++ 
b/server/src/main/java/org/apache/uniffle/server/block/PartitionedShuffleBlockIdManager.java
@@ -110,6 +110,10 @@ public class PartitionedShuffleBlockIdManager implements 
ShuffleBlockIdManager {
 
     Map<Integer, Roaring64NavigableMap> partitionToBlockId = 
shuffleIdToPartitions.get(shuffleId);
 
+    if (partitionToBlockId == null) {
+      return RssUtils.serializeBitMap(Roaring64NavigableMap.bitmapOf());
+    }
+
     long expectedBlockNumber = 0;
     Roaring64NavigableMap res = Roaring64NavigableMap.bitmapOf();
     for (int partitionId : partitions) {
@@ -118,7 +122,15 @@ public class PartitionedShuffleBlockIdManager implements 
ShuffleBlockIdManager {
       lockForBitmap.readLock().lock();
       try {
         Roaring64NavigableMap bitmap = partitionToBlockId.get(partitionId);
-        res.or(bitmap);
+        if (bitmap != null) {
+          res.or(bitmap);
+        } else {
+          LOG.debug(
+              "Bitmap is null for app: {}, shuffleId: {}, partitionId: {}",
+              appId,
+              shuffleId,
+              partitionId);
+        }
       } finally {
         lockForBitmap.readLock().unlock();
       }

Reply via email to