BG-Software-LLC / WildStacker

Stacked drops, stacked entities, stacked blocks and stacked spawners in one plugin!
https://bg-software.com/wildstacker/
GNU General Public License v3.0
92 stars 37 forks source link

Memory Leak with Entities #327

Closed skw359 closed 2 years ago

skw359 commented 2 years ago

Minecraft's Version

Purpur - git-Purpur-1171 (MC: 1.16.5)

Plugin's Version

Build 3.6.0

Describe the bug

There is a memory leak with high entity counts (tile entities as well) - it looks like it holds on to unloaded/loaded entities image

To Reproduce

Have a server with lots of entities and/or tile entities and use WildStacker. Using any dev version reproduces the issue as well.

Additional Information

Here is my current config: https://pastebin.com/SHhNHGw2

OmerBenGera commented 2 years ago

Use latest dev build. If it still occurs, reopen the issue and provide me with your profiler.

skw359 commented 2 years ago

What do you want from the profiler, or what should I do specifically? (since it's happening on the latest dev builds)

OmerBenGera commented 2 years ago

What do you want from the profiler, or what should I do specifically? (since it's happening on the latest dev builds)

The hprof filei itself so I can analyze it myself. A screenshot of it is not helpful.

skw359 commented 2 years ago

Sure, is there a way I can privately send it to you?

OmerBenGera commented 2 years ago

Sure, is there a way I can privately send it to you?

Send it here via mediafire or something else, there is nothing special in this file that must not be viewed by the public.

skw359 commented 2 years ago

Heapdumps take a snapshot of the server's heap, which can contain sensitive data (database passwords, etc.) so I am a bit hesitant sharing an openly available public link to such a thing. I could send it to you via Discord DMs if that's okay with you (on mediafire or something) and continue the conversation from here on GitHub.

OmerBenGera commented 2 years ago

Sure - what is your discord?

skw359 commented 2 years ago

Wizz#0607 GitHub omitted the 0 for some reason so I had to put it in code lmao

OmerBenGera commented 2 years ago

After looking into the heap, we noticed the issue comes from metadata of entities and not from WildStacker. It seems like mcMMO use Metadata as a way to store data, causing the data to never get cleared. For now, we keep the issue and hopefully mcMMO will not use this system anymore.

Also, another thing you should do is to report the issue to Paper, hopefully they can fix it on their side as well so no plugins can leak data.

skw359 commented 2 years ago

Ah I see, what would I report to Paper? I think I can report this stuff to mcMMO about metadata of entities not getting cleared

OmerBenGera commented 2 years ago

Ah I see, what would I report to Paper? I think I can report this stuff to mcMMO about metadata of entities not getting cleared

Try to report to Paper that when entities are removed, metadata saved by other plugins is not deleted causing it to stay in cache.

WarnDa commented 2 years ago

As I didn't see issue on paper's github I contacted them about the issue and here are the answer : https://discord.com/channels/289587909051416579/289587909051416579/910694989019901972

Screenshot_7053
skw359 commented 2 years ago

Omg, I totally forgot, thank you a ton for doing it (even though you didn't have to!) I linked the mcMMO commit to them, though it didn't fix the memory leak on their side yet 😅 hopefully a resolution will come to their side soon

brasilcraft54 commented 2 years ago

have you found a solution for this?

OmerBenGera commented 2 years ago

have you found a solution for this?

This is not an issue with WildStacker.

OmerBenGera commented 2 years ago

I am closing this for now, as it's not related to WildStacker. Make sure the plugins you use clean their metadata properly from entities, and they listen to the EntityRemoveEvent from Paper for better detection of removal of entities.