mojira.dev
MC-149777

Crash when loading world: java.util.ConcurrentModificationException when using Java 11 or above

When attempting to play attached world in Minecraft client, game may crash, then freeze. Doesn't always happen. Crash report is only printed in launcher, not saved.

1.14: [^crashreport.txt]

java.util.ConcurrentModificationException
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
	at cje.b(SourceFile:67)
	at cje.a(SourceFile:57)
	at cff.a(SourceFile:98)
	at cfi.a(SourceFile:86)
	at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:496)
	at java.base/java.util.stream.IntPipeline.max(IntPipeline.java:459)
	at cfi.a(SourceFile:86)
	at cfd$c.a(SourceFile:175)
	at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:496)
	at java.base/java.util.stream.IntPipeline.max(IntPipeline.java:459)
	at cfd$c.a(SourceFile:176)
	at cfd$c.<init>(SourceFile:98)
	at cfd.a(SourceFile:280)
	at cet.a(SourceFile:25)
	at ces$a.a(SourceFile:89)
	at bwy.a(SourceFile:187)
	at bxc.d(SourceFile:44)
	at bxc.a(SourceFile:199)
	at us.a(SourceFile:461)
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38)
	at us.a(SourceFile:455)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
	at uu.b(SourceFile:57)
	at agk.e(SourceFile:83)
	at agk.a(SourceFile:123)
	at agk.run(SourceFile:91)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)

Linked issues

Attachments

Comments 21

This might happen because you're using a newer version of Java than it was designed for. The Minecraft launcher currently recommends Java 8 Update 51. (Nevertheless, Minecraft should work with newer Java versions.)

Still occurs with 1.14.1-pre1.

[media]

Maity, may I ask what that .java file does?

That should be treated as the code analysis and fix suggestion. It shows why the crash can happen (because worldgen and server threads use the structure manager hash map concurrently)

11 more comments

This bug is caused mainly by bad programming that mojang refuses to fix even though it isn't hard to fix. As a workaround, you can use the fabric modloader with the fabric API installed, or you can use java 8.

Given 21w19a now has a dependency on Java 16, I'd recommend a fix for this issue before release.

was gonna make my own bug report but I saw this and this is close enough,

servers for 21w19a crash when loading my world that was created in 21w18a

[media][media]

so if this is fixable by me (I assume I need to download Java 16?) how do I fix it and how do I upgrade to Java 16

It also wont start a fresh server with no worlds yet. Wont even generate the needed files such as the Eula or server properties. This is bad for me because I play 80% on servers so my friend can join when we want instead of having them visit me and use LAN.

EDIT: This was simply because I didn't have Java 16 installed. 

this is not suited for the bugtracker, but as I assume this ticket is going to attract many of these questions, answer is go to https://adoptopenjdk.net and follow some simple installation prompts, make sure to download java version 16.

@unknown, that is a different issue than this bug. You need to install Java 16 to be able to run the server after 21w19a, and I'd suggest you go to Community Support if you need further assistance.

laputan

billysjoberg

Confirmed

Very Important

Crash

Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, 1.15.2, 20w13b, 20w15a, ..., 1.16.1, 20w28a, 20w29a, 1.16.4 Pre-release 2, 20w46a

21w20a

Retrieved