Preload ThreadLocalRandom to avoid java.lang.ClassCircularityError: java/util/concurrent/ThreadLocalRandom #14030
+6
−0
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.
See https://scans.gradle.com/s/ghszeelntq2n6/console-log/task/:instrumentation:pekko:pekko-http-1.0:javaagent:tapirTest?anchor=574&page=1
During transformation of
ThreadLocalRandom
we get a circularityNote that the code path in
ConcurrentHashMap
that loads theThreadLocalRandom
isn't always taken which makes this hard to reproduce. Also this isn't the only code path in the transformation that usesConcurrentHashMap
and can trigger this failure. Now the transformation failing isn't really a big deal as the exceptions during the transform are suppressed. What is problematic is that this error leavesConcurrentHashMap
in a broken state where the next usage of it also produces the same error, see https://bugs.openjdk.org/browse/JDK-8164165 So further down we have anotherClassCircularityError
that is visible to the application