You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ascheman (via GitHub)" <gi...@apache.org> on 2026/07/24 14:28:23 UTC

[PR] Fix windows flake: decoder test dumps out of @TempDir [maven-surefire]

ascheman opened a new pull request, #3400:
URL: https://github.com/apache/maven-surefire/pull/3400

   `Verify / windows-latest jdk-8` intermittently fails whole `CommandChannelDecoderTest` runs with:
   
   ```
   org.junit.platform.commons.JUnitException: Failed to close extension context
   Caused by: java.io.IOException: Failed to delete temp directory C:\...\Temp\junit-...
     Suppressed: java.nio.file.DirectoryNotEmptyException
   ```
   
   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 `DumpErrorSingleton` into the JUnit `@TempDir`, and several tests write `.dumpstream` files there. On Windows a freshly written file can be transiently locked (antivirus/indexer) exactly when the `@TempDir` cleanup 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 clean` removes them, and the files remain inspectable after CI runs. `CommandChannelDecoderTest` is the only test class using this pattern.
   
   ---
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix windows flake: decoder test dumps out of @TempDir [maven-surefire]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3400:
URL: https://github.com/apache/maven-surefire/pull/3400#discussion_r3646202469


##########
surefire-booter/src/test/java/org/apache/maven/surefire/booter/spi/CommandChannelDecoderTest.java:
##########
@@ -63,12 +61,13 @@
 public class CommandChannelDecoderTest {
     private static final Random RND = new Random();
 
-    @TempDir
-    Path tempFolder;
-
     @BeforeEach
     public void initTmpFile() {
-        File reportsDir = tempFolder.toFile();
+        // Not a JUnit @TempDir: the decoder writes .dumpstream files into this directory,

Review Comment:
   Minor naming: initTmpFile() no longer initializes a temp file/temp dir (it now configures DumpErrorSingleton to write into target/decoder-dumps). Renaming the method would better reflect its purpose and avoid confusion for future maintainers.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix Windows flake in CommandChannelDecoderTest [maven-surefire]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy merged PR #3400:
URL: https://github.com/apache/maven-surefire/pull/3400


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org