When stopping the server, sometimes this happens:
[11:30:02] [Server Shutdown Thread/INFO]: Stopping server
Exception in thread "Server Shutdown Thread" java.lang.NullPointerException
at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$MapIterator.nextEntry(Long2ObjectOpenHashMap.java:511)
at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$ValueIterator.next(Long2ObjectOpenHashMap.java:706)
at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:228)
at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:242)
at it.unimi.dsi.fastutil.objects.AbstractObjectCollection.toArray(AbstractObjectCollection.java:83)
at java.util.ArrayList.<init>(ArrayList.java:177)
at com.google.common.collect.Lists.newArrayList(Lists.java:129)
at lr.a(SourceFile:159)
at ls.a(SourceFile:884)
at net.minecraft.server.MinecraftServer.a(SourceFile:372)
at net.minecraft.server.MinecraftServer.u(SourceFile:397)
at net.minecraft.server.MinecraftServer$2.run(SourceFile:738)[11:30:02] [Server Shutdown Thread/INFO]: Stopping server
Exception in thread "Server Shutdown Thread" java.lang.NullPointerException
at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$MapIterator.nextEntry(Long2ObjectOpenHashMap.java:511)
at it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap$ValueIterator.next(Long2ObjectOpenHashMap.java:706)
at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:228)
at it.unimi.dsi.fastutil.objects.ObjectIterators.unwrap(ObjectIterators.java:242)
at it.unimi.dsi.fastutil.objects.AbstractObjectCollection.toArray(AbstractObjectCollection.java:83)
at java.util.ArrayList.<init>(ArrayList.java:177)
at com.google.common.collect.Lists.newArrayList(Lists.java:129)
at lr.a(SourceFile:159)
at ls.a(SourceFile:884)
at net.minecraft.server.MinecraftServer.a(SourceFile:372)
at net.minecraft.server.MinecraftServer.u(SourceFile:397)
at net.minecraft.server.MinecraftServer$2.run(SourceFile:738)Code analysis by @unknown can be found in this comment.
Comments 3
Is this still an issue in the most recent versions (currently that is 1.12.2, or the latest 1.13 development snapshot 18w20c) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time. If you are the owner/reporter of this ticket, you can modify the affected version(s) yourself.
The 1.10 MCP name for the method causing this is
net.minecraft.world.gen.ChunkProviderServer.saveChunks(boolean)(MCP 9.30 line 189)I am not sure if this is the reason, but the class
net.minecraft.server.gui.MinecraftServerGui.createServerGui().new WindowAdapter() {...}.()calls the methodnet.minecraft.server.MinecraftServer.initiateShutdown()to shutdown the server, however the classnet.minecraft.server.MinecraftServer.main().new Thread() {...}.(String)does this as well. If I understand it correctly, ShutdownHooks are executed afterSystem.exit()is called, but maybe the server thread and the shutdown thread try to save at the same time.