Slimefun

Slimefun

3M Downloads

RAM overload with backpacks

TwinkleToes777 opened this issue · 11 comments

commented

❗ Checklist

  • I am using the official english version of Slimefun and did not modify the jar.
  • I am using an up to date "DEV" (not "RC") version of Slimefun.
  • I am aware that issues related to Slimefun addons need to be reported on their bug trackers and not here.
  • I searched for similar open issues and could not find an existing bug report on this.

📍 Description

One player on my server uses backpacks heavily, his Slimefun data file weights 10.1MB, when he joins, there is about 50% chance that the server will crash with out of memory error, this error happens when the server has 16 GB of RAM allocated and he is the only player on the server.

📑 Reproduction Steps

Have a player with huge amount of backpacks full of items with 10.1MB slimefun player data file in total, join the server and observe about 50% of times it crashing or ram usage going high

💡 Expected Behavior

I expected RAM usage of backpacks to not be so high, maybe load them only on use instead of all at once on join?

📷 Screenshots / Videos

No response

📜 Server Log

During out of memory crash, I saw mention of: io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile and io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config and org.bukkit.configuration.file.YamlConfiguration.loadConfiguration

📂 /error-reports/ folder

No recent errors here

💻 Server Software

Purpur

🎮 Minecraft Version

1.19.x

⭐ Slimefun version

Slimefun DEV - 1104 (git c977454)

🧭 Other plugins

No response

commented

Do you mind providing the file of said player? (The file is named in UUID format, under data-storage/Slimefun/Players/<uuid>.yml)

commented

This aint a fun issue to solve sadly.
The quickest and dirtiest way is to delete the file or shorten it.

commented

Do you mind providing the file of said player? (The file is named in UUID format, under data-storage/Slimefun/Players/<uuid>.yml)

I renamed it to .txt, because github does not support uploading .yml
slimefun-player-data-file.txt

commented

Hey, so I don't believe the extremely hefty file is the cause of your OOM. The string at most will occupy 21MB, which implies that your server is already nearing the max heap limit.
I'd suggest you check via a heapdump on OOM (-XX:+HeapDumpOnOutOfMemoryError).

commented

Please provide the entire error

commented

[Craft Scheduler Thread - 814 - Slimefun/WARN]: [Slimefun] Plugin Slimefun vDEV - 1104 (git c977454) generated an exception while executing task 4745749
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3537) ~[?:?]
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228) ~[?:?]
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:582) ~[?:?]
at java.lang.StringBuilder.append(StringBuilder.java:179) ~[?:?]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:153) ~[purpur-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:128) ~[purpur-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:309) ~[purpur-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config.(Config.java:89) ~[Slimefun4 - DEV 587 (git a1952).jar:?]
at io.github.thebusybiscuit.slimefun4.libraries.dough.config.Config.(Config.java:100) ~[Slimefun4 - DEV 587 (git a1952).jar:?]
at io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile.(PlayerProfile.java:82) ~[Slimefun4 - DEV 587 (git a1952).jar:?]
at io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile.lambda$get$5(PlayerProfile.java:406) ~[Slimefun4 - DEV 587 (git a1952).jar:?]
at io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile$$Lambda$11344/0x000079951416b970.run(Unknown Source) ~[Slimefun4 - DEV 587 (git a1952).jar:?]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.19.4.jar:git-Purpur-1985]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.19.4.jar:git-Purpur-1985]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.19.4.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:840) ~[?:?]

commented

so I finally was able to track down this problem, it happens with any backpack at all, it doesn't even have to be a big player file, it just needs opening the backpack many times in a short time.
I used this JVM flag: -XX:+HeapDumpOnOutOfMemoryError
then I analyzed it with Eclipse Memory Analyzer and the result was that 7.4gb ram is used by something unlabeled, but going in details it says that it's used by Thread, and there are very many slimefun threads, so I'm guessing it's caused by spawning very many threads in a short time

commented

Without info we can’t do much

commented

Send us the dump please

commented

Send us the dump please

my internet is very slow (under 1 mb/s) so sending the dump is not really an option, it also contains sensitive info such as passwords, but I can provide screenshots of desired areas in Eclipse Memory Analyzer

commented

for the time being, disabling backpacks and using a slimefun addon that adds "backpack unloader" machine, is my solution to this problem