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

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new f84674be45 [common] Fix possible deadlock in ParallelExecution (#7355)
f84674be45 is described below

commit f84674be451f35ccbb8ef645ce7ec84ffe7b6e3e
Author: tsreaper <[email protected]>
AuthorDate: Sat Mar 7 10:31:14 2026 +0800

    [common] Fix possible deadlock in ParallelExecution (#7355)
    
    Currently, if `readerSupplier.get()` in `ParallelExecution#asyncRead`
    throws an exception, it is not catched, causing deadlock. This PR fixes
    the possible deadlock.
---
 .../main/java/org/apache/paimon/utils/ParallelExecution.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/paimon-common/src/main/java/org/apache/paimon/utils/ParallelExecution.java 
b/paimon-common/src/main/java/org/apache/paimon/utils/ParallelExecution.java
index f3aabb8bac..cb8b1c1f65 100644
--- a/paimon-common/src/main/java/org/apache/paimon/utils/ParallelExecution.java
+++ b/paimon-common/src/main/java/org/apache/paimon/utils/ParallelExecution.java
@@ -111,6 +111,16 @@ public class ParallelExecution<T, E> implements Closeable {
 
     private void asyncRead(
             Supplier<Pair<RecordReader<T>, E>> readerSupplier, Serializer<T> 
serializer) {
+        try {
+            asyncReadImpl(readerSupplier, serializer);
+        } catch (Throwable e) {
+            this.exception.set(e);
+        }
+    }
+
+    private void asyncReadImpl(
+            Supplier<Pair<RecordReader<T>, E>> readerSupplier, Serializer<T> 
serializer)
+            throws Exception {
         Pair<RecordReader<T>, E> pair = readerSupplier.get();
         try (CloseableIterator<T> iterator = 
pair.getLeft().toCloseableIterator()) {
             int count = 0;
@@ -148,8 +158,6 @@ public class ParallelExecution<T, E> implements Closeable {
             }
 
             latch.countDown();
-        } catch (Throwable e) {
-            this.exception.set(e);
         }
     }
 

Reply via email to