Rui Fan created FLINK-40446:
-------------------------------
Summary: UnalignedCheckpointRescaleWithMixedExchangesITCase is
unstable: @TempDir cleanup races with post-cancel async checkpoint
Key: FLINK-40446
URL: https://issues.apache.org/jira/browse/FLINK-40446
Project: Flink
Issue Type: Bug
Reporter: Rui Fan
Assignee: Rui Fan
UnalignedCheckpointRescaleWithMixedExchangesITCase.testRescaleFromUnalignedCheckpoint
is occasionally unstable. The test body passes, but teardown fails:
{code:java}
java.io.IOException: Failed to delete temp directory /tmp/junit-...
Suppressed: java.nio.file.DirectoryNotEmptyException: /tmp/junit-...{code}
Root cause: the test ends each job with `jobClient.cancel().get()`. cancel() is
asynchronous, so .get() only means cancellation was acknowledged, not that the
job
reached a terminal state. The test then returns and JUnit deletes the @TempDir
(which
also serves as the checkpoint dir) while the source subtasks' async snapshot of
the
just-completed checkpoint is still writing SourceReaderState into the
file-merging
"taskowned" directory. The post-order delete walk then hits
DirectoryNotEmptyException.
It only reproduces with file-merging enabled
(execution.checkpointing.file-merging.enabled
= true), which is why it shows up on a fraction of runs.
Fix: wait for the job to reach the CANCELED terminal state before proceeding,
instead of
relying on cancel().get() alone. (CommonTestUtils.terminateJob now waits for
CANCELED,
and the UC rescale ITCases go through it.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)