[
https://issues.apache.org/jira/browse/FLINK-40446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115943#comment-18115943
]
Martijn Visser commented on FLINK-40446:
----------------------------------------
Backported to:
release-2.3: 257e5047c2cfa0b320fb672f74a32bd9df7ed063
release-2.2: 14814adcac099aa6258cc1f7993760fcd00a5d6d
release-1.20: daeebe2bf5c514fd9fec517d7692707029da83fd
> 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
> Affects Versions: 2.3.0, 2.2.1, 1.20.5
> Reporter: Rui Fan
> Assignee: Rui Fan
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.2.2, 1.20.6, 2.3.1, 2.4.0
>
>
> 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)