Superflat world with very tall layers cause OutOfMemoryError on world rendering
Originally reported in the help-me channel.
I was testing out a few changes to my world's data pack. That consisted of increasing the height 512 blocks further down, and adding a new flat world generation overriding the old layers specified when creating the world a decade ago.
Before I started, I copied the world as a backup. Every time I made a change, I deleted the world after loading it in, and pasted in the backup, but with the data pack changes. The backup had the DH SQLite database deleted.
The last change I made, was changing the second layer, stone, from a height (tallness, not offset) of 1 block to 255 blocks. When I started the game and loaded in the world, it stalled. I did not entirely freeze or deadlock, but continued running. It was reporting lots of errors in the chat and log. See the endlessly long log file generated from this (5 MB; it may have been cut off; I originally stored the text content on the clipboard for uploading here). It contains many errors, such as array indices out of bounds, so it's definitely an issue past insufficient hardware resources.
---
After a while, I set the CPU load to "minimal impact". The client was running fine after that, however, I was getting the "DH overloaded" message in the chat, repeatedly. I am not sure if the internal server was running as expected.
Even with minimal impact, the game was then stalling when I moved a few chunks away. That was not the case before. I did not pressure it so much with generating new chunks so filled, in the past, though.
After this stall, while writing the first post, the game stopped responding completely. Then the framebuffer blacked out. I Could move the window and close it with the titlebar button, which I eventually did.
More follows in subsequent posts (max letter limit in this one).
14 Replies
I then disabled all the mods in Prism, and launched the game again. Went straight into the world again, changing nothing else (32 chunks r-d, 8 GB heap). No issues flying around in spectator mode at full speed in all newly generating chunks. Slightly noticeably lag spikes (lasting max 0.01 seconds (estimate)), but didn't really interfere with the 100-140 fps. The chunks also generated very fast, keeping up with my flying speed.
---
I quit the game again, re-enabled all the mods in Prism, launched the game, and went directly into my world. No errors reported in the chat (nor anything noticeable in the log, I believe). No OOM issues. No stuttering or freezing. A few "DH overloaded", but that's expected, as the CPU load was still set to "minimum impact".
Flew into the chunks I generated in vanilla, as well as into ungenerated chunks. Worked fine for a short while, then the game stalled like it normally does when DH is generating lots of LODs. Let the game work, and eventually it came back to life, unlike last time.
Vanilla chunks were then seriously struggling. They either did not load, or flashed in for a second, before disappearing again. LODs struggled, too, but loaded somewhat at higher CPU loads. The LOD chunks were also seriously messed up (not just missing), and time did not fix them.
I then flew back into the chunks I have previously populated manually. By the time I had reached it, vanilla chunks had entirely stopped loading. Took these 4 screenshots.
I took this screenshot from a few days prior. It shows how it's supposed to look. The two last screenshots were taken right behind that bridge, to the left. (Ignore the rendering issues on the bridge far behind, they're caused by DH's cave culling.)
After quitting the world, the game has now been stuck on the "Saving world" screen for 50 minutes (assumed the game was deadlocked, so I killed it).
Last log output:
I checked the log after quitting the world. There was no more output for the 50 minutes duration that I waited, nor when I quit the game, except for the "process was killed by user".
Loaded up the world again just now. Vanilla chunks all work fine, but the DH database seems corrupted. Nothing new is being generated even at "aggressive".
Changed DH distance from 128 to 64 at 23:06:25.
Deleted the SQLite database, and loaded in the world on aggressive. There are still lots of errors with the DH chunks, either completely filling them with air, or generating black surfaces. Yet there is not a single error in the log, and no mention of "DH overloaded" in the chat.
Repeated the step with 12 GB instead of 8 GB allocated to the JVM. The DH chunks are less erronous. I did not spot large parts of the chunks being filled with air instead of LODs, but I did still spot black surfaces. (The first strip should not be black. The second strip is just empty space into void, so that's correct). (Actually, looking at it again, some of those chunks of bedrock/stone/sandstone/sand/desert are replaced with air. Strange. (Also, nevermind, moved a bit, missing LODs are happening again. Massively).
Well, I've gotten the world playable. But under no circumstance can I get LODs to render correctly anymore. Deleting the config to draw in the default does not help. Disabling cave culling does not help. 7. Pixel Art, all else set to extreme. Yet LODs don't generate correctly whatsoever:
Eh, sorry, I think I have been under the impression that the LODs regenerate when I change the LOD generation settings, as the LODs are reloaded, like when you change the LOD graphics settings. Apparently not true, so the database must have been corrupted.
Actually, this is definitely a bug. I consistently reproduce this issue.
Steps:
1. Enter the world, and ensure you are outside of the vanilla rendering distance in step 4, for the structures that DH bugs out with.
2. Go to the title screen.
3. Delete the database.
4. (optional, any values will work) Set the vanilla render distance to 4, and the DH distance to 32.
5. Load up the world. Look, the DH LODs are fine.
6. Move closer to the structure such that they're near the vanilla rendering distance (VRD). You see the LODs within VRD being replaced with vanilla chunks, but those right outside of that simply blanking out.
7. Move back away, such that the structure is outside of the vanilla rendering distance. The DH LODs are now permanently set to air in that area.
NEVER delete any game file during the game running!!!
That included DH database
Always close the game first!
Deleting the game files during runtime can permantelly damage the game and might require total game reinstall to fix
Several of the times I tested it, I did close the game in the meantime.