Publish the Java binary atomically across JVMs (#329) - #353
Open
css521 wants to merge 2 commits into
Open
Conversation
Serialize extraction with a cross-process file lock, stage and validate the bundled binary before an atomic rename, and recover stale cache entries without exposing a partial target. Add real multi-JVM and multi-classloader regressions.
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 #329.
BinaryResolver previously copied directly to the shared cache path and only set the executable bit afterwards. Parallel JVMs could therefore resolve and execute a partial or non-executable file, while an interrupted copy left a truncated cache entry that later runs trusted permanently.
This serializes extraction across JVMs with a file lock, copies to an owner-specific staging file in the cache directory, validates its length and permissions, and publishes it with an atomic rename. Cache hits are accepted only when they are regular, complete, and executable. Lock acquisition is bounded and also handles overlapping locks from independent classloaders in one JVM.
Verified locally:
The synthetic executable used by the regression suite is a POSIX shell payload, so that suite explicitly skips on Windows; Windows publication is not claimed as locally verified.