Memory leak
Overwrite987 opened this issue · 11 comments
Server Version
ShieldSpigot 1.16.5 and Leaf 1.20.6 (yeah, also works on paper 100%)
Resource Version
6.1.1-SNAPSHOT-b1038
Dump Information
https://ci.craftationgaming.com/dump?id=ubaqozomef
Describe The Bug
After certan amount of time plugin consumes all the memory, which causes out of memory error
Expected Behavior
OOM should not happen
Steps To Reproduce
- Install plugin on the server (maybe requires any other installed plugin, that ItemJoin depend or sonfdepend, like skins restorer) (also more players - faster OOM)
- wait for it
Additional Info
dump from 1.20.6 can be downloaded here: https://mega.nz/file/QiYAgBRQ#FmjRzNIUbyQNdRMwSvr9AkKn7IPrswKZqPHOYy6ocT0
crash report from 1.16.5 can be found here: https://pastebin.com/ZMP2vHZ2
Checklist
- I am running latest version of this resource.
- I have read the wiki to make sure it's not an issue with configuration.
- I ticked all of these boxes without actually reading them.
- I have checked that my bug report is unique and a previous report does not exist.
additional info: Only happens if skins restorer is installed
Really odd, it doesn't appear you are using any items that would require ItemJoin to interact with SkinsRestorer.
Your heap file is a bit bare. I am unfamiliar with ShieldSpigot/Leaf, are you able to generate a timings report? Preferably over a duration that has the most server activity.
additional info: Only happens if skins restorer is installed
Really odd, it doesn't appear you are using any items that would require ItemJoin to interact with SkinsRestorer. Your heap file is a bit bare. I am unfamiliar with ShieldSpigot/Leaf, are you able to generate a timings report? Preferably over a duration that has the most server activity.
Well, not timings, but spark I can.
Thread * : https://spark.lucko.me/gvCFRIjJ9G
Normal: https://spark.lucko.me/IZpnT5n3rH
ha lol
thought that was only happening with SR
but actualy no, I just didnt wait enough!
New dump: https://ci.craftationgaming.com/dump?id=uhezexiwaz
From 1.16 yeah, and also has memory leak
And now plugins are:
[05:12:33 INFO]: Plugins (16): DeluxeMenus, EvelAPI, EvelLobbyCore, FastAsyncWorldEdit (WorldEdit), HideItem, ItemJoin, LiteBans, LuckPerms, PlaceholderAPI, SpawnPlugin, TAB, UltimateAutoRestart, Vault, ViaVersion, WorldEdit, ZNPCsPlus
So I'll be honest here I am pretty lost. From what you provided ItemJoin is doing essentially nothing, consuming basically zero resources. This makes sense given your setup as you only have a single item defined.
The spark links you provided don't really show much and your heap dump shows that ItemJoin has barely any data retention (not even above 0%). If there was a memory leak it would have shown in the heap if it was ItemJoin. Digging into the heap dump I do see a lot of utilization going to lol.pyr.znpcsplus
and it appears to be with their WrappedBlockState class (70,000 hashmap entries). Aside from that there is a lot of usage for net.minecraft.advancements.AdvancementProgress
.
Out of curiosity what made you think this is ItemJoin related? Similar to the aforementioned SkinsRestorer problem, have you tried removing ItemJoin and seeing if this issue still occurs after waiting a while?
Well, that's mighty annoying. Sorry about that, the heap analyzer program I was using didn't show that data. I swapped to a different analyzer and I do indeed see what you provided in your screenshot. I think I found the issue, give me a bit to work on a fix for this and test it.
I'll provide a fixed snapshot as soon as I verify these changes.
Confirmed the issue and made some changes that appear to have fixed it. The issue isn't technically a memory leak, the issue is whole player instances were being saved to a hashmap which are significantly large in size. Additionally, it was being done multiple times for different actions. Idk why I did this but it was an oversight on my part. I made some changes to instead only save the player's unique id which will resolve this problem. I also introduced some changes to improve garbage collection (unused hashmaps).
Link; https://ci.craftationgaming.com/downloads
Remember to remove your old ItemJoin.jar file
Let me know if this happens again, I did some testing for a while and it seems to work as intended. If this issue occurs again please provide a new heap dump.
well for NOW everything looks fine, but I think we have to wait for like few more days