Add workaround for JDK-8166253#2065
Merged
Merged
Conversation
marchof
approved these changes
Mar 7, 2026
This was referenced Mar 10, 2026
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.
For the past few days I observe frequent failures in AzurePipelines on JDK 6:
see build log for first commit in this PR
While
does not guarantee GCs and finalizations to happen, addition of it after every
out.getChannel().lock()in tests seems to increase chances to reproduce, so that it becomes even visible also in another test on JDK versions from 6 to 10, as well as in GitHub Actions and locally on my machine:see build logs for second commit in this PR
And so I suspect that these tests demonstrate http://bugs.openjdk.org/browse/JDK-8166253 which was fixed in JDK 11.
Our main code seems to be affected too - like tests it does not preserve reference on lock object:
jacoco/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/output/FileOutput.java
Line 83 in 2eb2483
so there is a chance that another FileOutput writing to the same file within same JVM will not receive OverlappingFileLockException while first one not yet finished writing data.
Note that this does not seem to affect filesystem level lock - see build log on Windows for the second commit in this PR - it hangs (blocked on the above call) in test
startup_should_throw_InterruptedIOException_when_execfile_is_locked_and_thread_is_interruptedbecauseOverlappingFileLockExceptionis not be observed after GC of FileLock.And maybe this might be an explanation of past reports about data corruption such as https://groups.google.com/g/jacoco/c/wrKJbyJyNII/m/WIe6yrewAwAJ
Following test
demonstrates such corruption: