1996fanrui opened a new pull request, #27205:
URL: https://github.com/apache/flink/pull/27205

   ## What is the purpose of the change
   
   testCompletionFutureCompletesAfterReporting test randomly hangs
   
   
https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=70776&view=logs&j=f0ac5c25-1168-55a5-07ff-0e88223afed9&t=e65258a6-40a1-5a09-c394-f70d913b73cd&l=10848
   
   
   ## Root Cause
   **Same-thread deadlock caused by ForkJoinPool work-stealing**
   
   Test expects async task to run on different thread, but 
`CompletableFuture.runAsync()` defaults to ForkJoinPool. 
   Its work-stealing mechanism may assign the async task to main thread, 
creating same-thread circular waiting.
   
   ## Deadlock Flow
   ```
   Main Thread: getReportStartedFuture().get() waits for async task → then 
complete reportBlockingFuture
                 ↓ (ForkJoinPool work-stealing)
   Same Thread:  executes ackCheckpoint() → complete getReportStartedFuture() → 
reportBlockingFuture.get() waits for main thread
                 
↑___________________________________________________________________|
                              DEADLOCK
   ```
   
   ## Solution
   Use dedicated thread pool:
   ```java
   CompletableFuture.runAsync(task, EXECUTOR_RESOURCE.getExecutor())
   ```
   
   ## Brief change log
   
   [FLINK-38642][checkpoint] Specify thread pool to avoid 
CheckpointCoordinatorTest hang


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to