Repository navigation
Give each mvn.cmd run its own temp directory - #13717
Merged
Merged
Conversation
%RANDOM% is seeded from the clock once per cmd.exe, so mvn.cmd processes started in the same second named their jvm.config and version temp files alike. Since the JVM reads the jvm.config file as an @argfile and it is kept until the JVM exits, parallel builds ran with each other's JVM arguments. mkdir fails on an existing name, so a retry loop yields a private directory.
gnodet-bot
reviewed
Oct 28, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
Verified fix for the %RANDOM% seed-collision race: the :mkTempDir subroutine uses mkdir atomicity with a 100-iteration retry loop, ensuring concurrent processes never share a temp file. All cleanup paths (normal exit, java failure, parser failure, JVM error) are covered. One nit below.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Comment on lines
+174
to
175
| rd /s /q "%VERSION_SETTINGS_DIR%" 2>nul | ||
| set "VERSION_SETTINGS_TEMP=" |
There was a problem hiding this comment.
After rd /s /q removes the directory, VERSION_SETTINGS_DIR stays defined (it still holds the now-deleted path). Only VERSION_SETTINGS_TEMP is cleared. For symmetry with the initial set "VERSION_SETTINGS_DIR=" at the top of the script, clear it here too.
Suggested change
| rd /s /q "%VERSION_SETTINGS_DIR%" 2>nul | |
| set "VERSION_SETTINGS_TEMP=" | |
| rd /s /q "%VERSION_SETTINGS_DIR%" 2>nul | |
| set "VERSION_SETTINGS_DIR=" | |
| set "VERSION_SETTINGS_TEMP=" |
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.
Fixes #13716.
mvn.cmdnow creates itsjvm.configargfile and itsmvn -vsettings dump inside a directory made by a new:mkTempDirroutine.mkdirfails when the name already exists, so processes that start in the same second, and therefore draw the same%RANDOM%values, retry with the next values instead of sharing a file. The directory is removed where the file used to be deleted.JVM_CONFIG_DIRandJVM_CONFIG_TEMPare cleared at the start, so a value inherited from the environment is never used or deleted.I have no Windows machine, so this has not been run outside CI. The Windows integration-test jobs on this PR run
MavenITmng4559MultipleJvmArgsTest, which failed in three of four failedmasterbuilds on 2026-10-22 and 2026-10-23; one green run does not prove a race fixed.