JingsongLi commented on PR #8855: URL: https://github.com/apache/paimon/pull/8855#issuecomment-5088794924
Could we avoid interrupting workers that have already finished reading and are only closing their readers? `latch.countDown()` happens before the try-with-resources closes the iterator. Therefore, after `take()` observes completion, the worker may still be inside `RecordReader.close()`. Calling `shutdownNow()` here interrupts that cleanup. `awaitTermination()` then only guarantees that the worker exited; it does not guarantee that cleanup completed successfully. I reproduced this with a reader whose `close()` waits on an interruptible semaphore. `ParallelExecution.close()` interrupted the cleanup and returned before the semaphore was released, with the cleanup operation never completed. The new test uses `acquireUninterruptibly()`, so it cannot expose this race. For the normal completed-read path, could we use `executorService.shutdown()` when `latch.getCount() == 0`, and reserve `shutdownNow()` for early cancellation? Alternatively, moving the countdown after resource cleanup would also avoid this race. -- 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]
