OutOfMemoryError is thrown when loading heavily oversized chunk
Oversized chunks (indicated by Saving oversized chunk [x, z] (n bytes) to external file c.x.z.mcc log in the console) causes major issues, such as crashing/freezing the server. Around 50,000,000+ bytes of oversized data is (probably) enough to reproduce the issue with the client with -Xmx8G or -Xmx4G This can be done via writable books (with many Unicode characters on every page) in shulker box, and shulker boxes in chests. (see the screenshots)
When the server saves the oversized chunk, it takes very long, but it usually doesn't throw an error but says "Saving oversized chunk...", and then when the server tries to load that oversized chunk, the error will be thrown on the server. (see below)
If it doesn't throw any error while loading the world, try decreasing the -Xmx.
This is a very critical problem for servers since anyone can exploit this bug with just writable book and shulker boxes.
logs on the client (no crash, it just throws an error and it gets stuck forever and it was done in single-player mode):
saving single-player world:
[00:34:03] [Server thread/INFO]: Stopping singleplayer server as player logged out
[00:34:03] [Server thread/INFO]: Stopping server
[00:34:03] [Server thread/INFO]: Saving players
[00:34:03] [Server thread/INFO]: Saving worlds
[00:34:03] [Server thread/INFO]: Saving chunks for level 'ServerLevel[New World]'/minecraft:overworld
[00:35:48] [IO-Worker-64/WARN]: Saving oversized chunk [10, -1] (53634893 bytes} to external file C:\Users\user\AppData\Roaming\.minecraft\saves\New World (25)\region\c.10.-1.mcc
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (New World (25)): All chunks are saved
[00:35:49] [Server thread/INFO]: Saving chunks for level 'ServerLevel[New World]'/minecraft:the_nether
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[00:35:49] [Server thread/INFO]: Saving chunks for level 'ServerLevel[New World]'/minecraft:the_end
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (New World (25)): All chunks are saved
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[00:35:49] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
loading single-player world (it gets stuck after the error is thrown):
[00:35:52] [Render thread/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[00:35:52] [Render thread/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[00:35:52] [Render thread/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[00:35:52] [Render thread/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[00:35:52] [Render thread/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[00:35:52] [Render thread/INFO]: Reloading ResourceManager: Default
[00:35:53] [Render thread/INFO]: Loaded 7 recipes
[00:35:53] [Render thread/INFO]: Loaded 927 advancements
[00:35:55] [Render thread/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[00:35:55] [Server thread/INFO]: Starting integrated minecraft server version 1.16.5
[00:35:55] [Server thread/INFO]: Generating keypair
[00:35:55] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[00:36:57] [IO-Worker-64/ERROR]: Caught exception in thread Thread[IO-Worker-64,5,main]
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:3664) ~[?:1.8.0_51]
at java.lang.String.<init>(String.java:201) ~[?:1.8.0_51]
at java.io.DataInputStream.readUTF(DataInputStream.java:661) ~[?:1.8.0_51]
at java.io.DataInputStream.readUTF(DataInputStream.java:564) ~[?:1.8.0_51]
at ms$1.a(SourceFile:25) ~[1.16.5.jar:?]
at ms$1.b(SourceFile:19) ~[1.16.5.jar:?]
at mj$1.a(SourceFile:49) ~[1.16.5.jar:?]
at mj$1.b(SourceFile:32) ~[1.16.5.jar:?]
at md.b(SourceFile:471) ~[1.16.5.jar:?]
at md.a(SourceFile:32) ~[1.16.5.jar:?]
at md$1.a(SourceFile:83) ~[1.16.5.jar:?]
at md$1.b(SourceFile:69) ~[1.16.5.jar:?]
at md.b(SourceFile:471) ~[1.16.5.jar:?]
at md.a(SourceFile:32) ~[1.16.5.jar:?]
at md$1.a(SourceFile:83) ~[1.16.5.jar:?]
at md$1.b(SourceFile:69) ~[1.16.5.jar:?]
at mj$1.a(SourceFile:49) ~[1.16.5.jar:?]
at mj$1.b(SourceFile:32) ~[1.16.5.jar:?]
at md.b(SourceFile:471) ~[1.16.5.jar:?]
at md.a(SourceFile:32) ~[1.16.5.jar:?]
at md$1.a(SourceFile:83) ~[1.16.5.jar:?]
at md$1.b(SourceFile:69) ~[1.16.5.jar:?]
at md.b(SourceFile:471) ~[1.16.5.jar:?]
at md.a(SourceFile:32) ~[1.16.5.jar:?]
at md$1.a(SourceFile:83) ~[1.16.5.jar:?]
at md$1.b(SourceFile:69) ~[1.16.5.jar:?]
at md.b(SourceFile:471) ~[1.16.5.jar:?]
at md.a(SourceFile:32) ~[1.16.5.jar:?]
at md$1.a(SourceFile:83) ~[1.16.5.jar:?]
at md$1.b(SourceFile:69) ~[1.16.5.jar:?]
at mj$1.a(SourceFile:49) ~[1.16.5.jar:?]
at mj$1.b(SourceFile:32) ~[1.16.5.jar:?]
Potential fixes:
- Max NBT size for an item. When someone makes an item that exceeds the max value, just delete an item.
- Set the max amount of writable books in one container.
Expected behavior: Does not throw any errors and should load the world normally.
Actual behavior: Error is thrown when loading the world and it gets stuck forever.
2021-05-25, 06:44 PM
2023-05-09, 10:18 AM
2023-05-09, 10:18 AM
1
3
-