Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAM overload with backpacks #4011

Closed
4 tasks done
TwinkleToes777 opened this issue Nov 2, 2023 · 11 comments · Fixed by #4127
Closed
4 tasks done

RAM overload with backpacks #4011

TwinkleToes777 opened this issue Nov 2, 2023 · 11 comments · Fixed by #4127
Labels
🐞 Bug Report A bug that needs to be fixed. ✔ Resolved This Issue has been resolved.

Comments

@TwinkleToes777
Copy link

❗ 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

@TwinkleToes777 TwinkleToes777 added 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. 🐞 Bug Report A bug that needs to be fixed. labels Nov 2, 2023
@iTwins
Copy link
Contributor

iTwins commented Nov 2, 2023

Please provide the entire error

@TwinkleToes777
Copy link
Author

[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) ~[?:?]

@Phoenix-Starlight
Copy link
Member

Phoenix-Starlight commented Nov 3, 2023

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

@TwinkleToes777
Copy link
Author

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

@J3fftw1
Copy link
Member

J3fftw1 commented Nov 5, 2023

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

@Phoenix-Starlight
Copy link
Member

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).

@TwinkleToes777
Copy link
Author

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

@J3fftw1
Copy link
Member

J3fftw1 commented Feb 14, 2024

Send us the dump please

@TwinkleToes777
Copy link
Author

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

@J3fftw1
Copy link
Member

J3fftw1 commented Feb 14, 2024

Without info we can’t do much

@TwinkleToes777
Copy link
Author

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

@variananora variananora added ✔ Resolved This Issue has been resolved. and removed 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. labels Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Report A bug that needs to be fixed. ✔ Resolved This Issue has been resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants