Chunky (Bukkit)

Chunky (Bukkit)

20.6k Downloads

[Bug] Memory Leak caused by POIs

Speiger opened this issue ยท 10 comments

commented

Hello there,

Chunk Pregenerator dev here, eh you have a memory Leak in your pregenerator that you didn't address.
Well its not yours but Mojangs. But you need to deal with it if you want to have anything more then a 100 chunkradius supported in your pregeneration.

Points of Interest are a memory leak in pregens eyes. That should be more then enough info for you.

commented

This is definitely more of a vanilla issue, and one that I've generally not had a great deal of time to debug beyond identifying that it exists. My prior assumptions have been that it was caused by the chunk saving system, as other platforms like Paper don't exhibit this problem and have a more resilient incremental saving system. I guess I could take another crack at profiling this to see if what you're saying is true about these POIs. Thanks for the tip! ๐Ÿ˜„

Please also add me on Discord if you'd like to keep in touch: pop4959#1781.

commented

Unless they implemented a better caching system then Mojang (which is not hard with the worst possible scenario (no unload)) its a issue for all Servers. Not a forge bug either. Pure Mojang issue and with Mojang mappings you can verify it in 5-10 minutes.

Also no problem.

Small edit: This also is also happening in singleplayer

commented

Has this been fixed @pop4959

commented

I have not had time to confirm the issue, but if it is a problem it is a bug in vanilla Minecraft, and not Chunky itself. There may be ways to help mitigate it that I could look into but this is really Mojang's problem to fix. If you're having issues, I would also take a look at your mod list and check that none of those are leaking memory during world gen as I have seen that a few times as well, and it certainly doesn't help.

commented

Sry for delivering that bombshell ^^"

For users how to solve this issue until the pregenerator here deals with it:

  • Restart the server and the points of interest get cleared. Though as the player walks around they get refilled and not unloaded.
  • For singleplayer you just need to restart the world not the game since the "memory leak" is bound to the server instance not a global memory issue.
commented

Looks like this should be fixed in 1.18 pre-release 6.

commented

@pop4959 before I see a issue ID that proofs that I am not believing it because Pre6 has no issue fix that comes even close to that.

The game now saves chunks whenever there is time spare to reduce autosave spikes

And this line does not address the "memory leak" but the bug that minecraft since 1.14 prioritizes saving over everything...
to the point of risking game crashes. This does not fix the memory leak.

commented

(Also Confirmed this bug still exists in 1.19.2) (Updating info just people know that it still exists in minecraft itself)

commented

I can confirm that there is a memory leak happen still. I try to pregenerate 1.8 million chunks, around 50% are done. After around 1 hour my server is by over 80GB Ram usage and I have to restart the server ...

Output between the leak: https://privatebin.net/?a61e6403921b82f4#Cv4htBx1tm7TYSE1tCWrAnmpDGPW5LckKzrprps7BBJc

commented

I can confirm that there is a memory leak happen still. I try to pregenerate 1.8 million chunks, around 50% are done. After around 1 hour my server is by over 80GB Ram usage and I have to restart the server ...

Output between the leak: https://privatebin.net/?a61e6403921b82f4#Cv4htBx1tm7TYSE1tCWrAnmpDGPW5LckKzrprps7BBJc

This looks entirely unrelated. In your case I am more ready to believe you have a misunderstanding of how the Java garbage collector works, as there is almost no situation where you should be running a server with an oversized heap like that.

Please read the FAQ and if you need further help troubleshooting please join the #chunky channel on our Discord server and I'm generally happy to work with you to understand what exactly is going on.

I will be locking this issue to further comments as it's largely non-productive to discuss a memory leak that is not caused by chunky here. Please report memory leaks in vanilla world generation, such as POIs, or memory leaks in world generation from other mods on their respective issue trackers so they can be properly fixed. Thank you!