-
Bug
-
Resolution: Fixed
-
P4
-
21.0.4, 23, 24
-
b11
-
aarch64
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8338582 | 23.0.2 | Aleksey Shipilev | P4 | Resolved | Fixed | b01 |
JDK-8338828 | 21.0.5 | Aleksey Shipilev | P4 | Resolved | Fixed | b05 |
-Xcomp -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:+TieredCompilation -XX:+VerifyOops -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
java.util.ConcurrentModificationException
at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1721)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:727)
at java.base/jdk.internal.util.ReferencedKeyMap.entrySet(ReferencedKeyMap.java:295)
at java.base/jdk.internal.util.ReferencedKeyTest.methods(ReferencedKeyTest.java:101)
at java.base/jdk.internal.util.ReferencedKeyTest.mapTest(ReferencedKeyTest.java:75)
at java.base/jdk.internal.util.ReferencedKeyTest.main(ReferencedKeyTest.java:49)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1575)
Looking at ReferencedKeyMap.entrySet:
@Override
public Set<Entry<K, V>> entrySet() {
removeStaleReferences();
return filterKeySet()
.map(k -> new AbstractMap.SimpleEntry<>(k, get(k)))
.collect(Collectors.toSet());
}
It seems to me that since the call to get(k) also calls removeStaleReferences(), a concurrent GC could trigger removal while building the set resulting in a ConcurrentModificationException. Shouldn't this method be calling map.get(k) directly instead? I'm unclear why it's failing with Graal though it might just be a timing a issue.
- backported by
-
JDK-8338582 jdk/internal/util/ReferencedKeyTest.java can fail with ConcurrentModificationException
- Resolved
-
JDK-8338828 jdk/internal/util/ReferencedKeyTest.java can fail with ConcurrentModificationException
- Resolved
- relates to
-
JDK-8338060 jdk/internal/util/ReferencedKeyTest should be more robust
- Resolved
-
JDK-8310913 Move ReferencedKeyMap to jdk.internal so it may be shared
- Resolved
- links to
-
Commit(master) openjdk/jdk21u-dev/affb895c
-
Commit(master) openjdk/jdk23u/2369d92f
-
Commit(master) openjdk/jdk/bfb75b96
-
Review(master) openjdk/jdk21u-dev/916
-
Review(master) openjdk/jdk23u/66
-
Review(master) openjdk/jdk/20499