Fix Windows flake in CommandChannelDecoderTest#3400
Open
ascheman wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Surefire Booter unit tests to avoid intermittent Windows temp-directory cleanup failures by moving dumpstream output out of JUnit’s @TempDir and into the module’s target/ directory, where it won’t be deleted as part of per-test cleanup.
Changes:
- Remove JUnit
@TempDirusage fromCommandChannelDecoderTest. - Initialize
DumpErrorSingletonto write dump files undertarget/decoder-dumps/to avoid Windows file-lock timing issues during temp cleanup. - Add in-code rationale describing the Windows flake and why
target/is used instead.
Comment on lines
64
to
+66
| @BeforeEach | ||
| public void initTmpFile() { | ||
| File reportsDir = tempFolder.toFile(); | ||
| // Not a JUnit @TempDir: the decoder writes .dumpstream files into this directory, |
The test initializes DumpErrorSingleton into the JUnit @tempdir; several tests write .dumpstream files there. On Windows a freshly written file can be transiently locked (antivirus, indexer) right when the @tempdir cleanup runs, failing the whole class with DirectoryNotEmptyException ('Failed to close extension context'). JUnit 5.14's resilient cleanup retries do not close the gap. Writing the dumps under target/ needs no post-test cleanup at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ascheman
force-pushed
the
bugfix/decoder-test-dump-tempdir-win
branch
from
July 24, 2026 14:55
48fb918 to
ca4ee96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verify / windows-latest jdk-8intermittently fails wholeCommandChannelDecoderTestruns with:Observed three times within a week on unrelated PRs (#3392, #3395 — e.g. https://github.com/apache/maven-surefire/actions/runs/30089175667/job/89469589427 and run 30089211662); every re-run is green.
Root cause: the test class initializes
DumpErrorSingletoninto the JUnit@TempDir, and several tests write.dumpstreamfiles there. On Windows a freshly written file can be transiently locked (antivirus/indexer) exactly when the@TempDircleanup runs — the cleanup throws and fails the whole class. Surefire's own I/O is fine (all dump writes use try-with-resources), and JUnit 5.14's resilient cleanup retries evidently do not close the gap.Fix: write the dumps under
target/decoder-dumps/instead — no post-test cleanup needed at all,mvn cleanremoves them, and the files remain inspectable after CI runs.CommandChannelDecoderTestis the only test class using this pattern.🤖 Generated with Claude Code