The bug
Server does not launch using Java 10. It was working fine before 1.13-pre5 (1.13-pre4 included). I included the log of the crash. Both OpenJDK and Oracle's JRE are affected. This issue does not seem to occur when using Java 8.
[16:53:37] [Bootstrap 0/ERROR]: Unable to build datafixers
java.util.ConcurrentModificationException: null
at java.util.HashMap.computeIfAbsent(HashMap.java:1139) ~[?:?]
at com.mojang.datafixers.DSL.taggedChoiceType(DSL.java:251) ~[server.jar:?]
at com.mojang.datafixers.types.templates.TaggedChoice.lambda$null$1(TaggedChoice.java:72) ~[server.jar:?]
at java.util.HashMap.computeIfAbsent(HashMap.java:1138) ~[?:?]
at com.mojang.datafixers.types.templates.TaggedChoice.lambda$apply$2(TaggedChoice.java:71) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Named.lambda$apply$0(Named.java:43) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Check$1.apply(Check.java:45) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Sum$1.apply(Sum.java:50) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Sum$1.apply(Sum.java:50) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Sum$1.apply(Sum.java:50) ~[server.jar:?]
at com.mojang.datafixers.types.templates.Sum$1.apply(Sum.java:50) ~[server.jar:?]
at com.mojang.datafixers.types.families.RecursiveTypeFamily.lambda$null$1(RecursiveTypeFamily.java:107) ~[server.jar:?]
at com.mojang.datafixers.types.templates.RecursivePoint$RecursivePointType.unfold(RecursivePoint.java:132) ~[server.jar:?]
at com.mojang.datafixers.types.templates.RecursivePoint$RecursivePointType.findCheckedType(RecursivePoint.java:183) ~[server.jar:?]
at com.mojang.datafixers.schemas.Schema.getType(Schema.java:80) ~[server.jar:?]
at com.mojang.datafixers.DataFixerBuilder.lambda$build$1(DataFixerBuilder.java:68) ~[server.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:844) [?:?]
Code analysis
Code analysis by @unknown in this comment.
Linked issues
is duplicated by 2
Attachments
Comments 13
I also can't run 1.15 pre5 with java 10
I'm gonna try with 1.8 now.
edit:
Starting the server with Java 1.8 made it work.
I read somewhere that you needed to use the jre version, I don't know if that's true though.
for those who don't know how, make your batchfile like this:
"%Path_to_java_directory%\java.exe" -Xmx(maximum memory) -Xms(minimum memory) -Xss(set stack size (for 32bit java if i'm not wrong)) -jar ServerFile.jar
In my case, that would be:
"C:\Program Files (x86)\Java\jre1.8.0_121\bin\java.exe" -Xmx1024M -Xms1024M -Xss1m -jar minecraft_server.jar
Kept failing for me with Java 10 (Oracle JDK). Tried with -Xss1m, didn't work, -Xss2m did work, but a subsequent restart didn't.
Java 8 (Oracle, 8u172) works.
The cause of this seems to be fairly simple: in the datafixuerupper library, com.mojang.datafixers.DSL.taggedChoiceType
is accessed from multiple threads (the Bootstrap 0
thread and the main
thread). This happens in EntityType
and BlockEntityType
(both of which call DataFixer.getSchema
), and that was introduced in 1.13-pre5.
That method calls Instances.TAGGED_CHOICE_TYPE_CACHE.computeIfAbsent
, where TAGGED_CHOICE_TYPE_CACHE
is a HashMap
. This call can happen from multiple threads, without any thread safety. That explains the ConcurrentModificationExceptions
, doesn't it? To fix it, the map could be made thread-local, or a ConcurrentHashMap
could be used, or some other similar fix.
However, that doesn't explain why there is no ConcurrentModificationException
in Java 8. The reason for that is actually fairly simple: they didn't bother to check (JDK-8071667) until Java 9 (instead broken behavior happened in that case). It was fixed in changeset 11714:0c3aa853064e. So, the code is still broken in Java 8, but it's silently broken instead of obviously broken.
You can get it from here. However, note that Java 8 is still supported and Java 10 is a separate major release so you don't necessarily need to switch. (Java 9 is no longer readily downloadable to my understanding)
but isent java and java SE different things. To my knowledge minecraft dosent need SE i usually just use it for netbeans
SE = standard edition, it's the same thing you'd get normally. I did link to the JDK though (which isn't needed to run, only to develop) instead of the normal download page, but that's mainly because the installers on that page are a lot less annoying; the page also has JREs.
It is interesting that java.com doesn't actually have Java 9 or 10, but that might be because 9 and 10 aren't long-term support on the new model (11 will be, so I'd assume it will be on there).
I have the same error using Oracle Java 10.0.1 in Debian 9.4