killerprojecte / Folia

A fork of Folia working to support more bukkit plugins
GNU General Public License v3.0
66 stars 9 forks source link

RAM Unknown exception #13

Closed 347180440 closed 9 months ago

347180440 commented 11 months ago

Expected behavior

This issue is a memory leak, and I'm not sure about the exact cause. I've uninstalled all plugins and tested it for a night with 5 players idling, and the memory usage slowly increased. Within a day, it reached the maximum RAM limit I set at 64GB. On average, there are around 10 players on the server, and once the memory overflows, the CPU maxes out at 100%, causing the server to freeze.

My suspicion is that it might be related to the server's world generation or calculations consuming a lot of RAM, but it's consuming it rapidly, and there's no garbage collection happening within a day. To rule out plugin-related issues, I've even uninstalled all plugins, but the problem persists. I've switched back to Purpur, and after a day, it hasn't exceeded 5GB of RAM usage, with no memory garbage. I'll have some free time to test other server cores to see if the issue remains.

If you've encountered a similar problem, please share your experiences. Let's work together to identify the root cause.

Observed/Actual behavior

1 2

Steps/models to reproduce

This issue has been present for several months, and it was challenging to detect. I hadn't been paying close attention until now when I discovered that the cause is a memory leak.

Plugin and Datapack List

Testing without any plugins.

Folia version

[05:29:24 INFO]: This server is running DirtyFolia version git-DirtyFolia-"8d7dee3" (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 8d7dee3 on ver/1.20) You are running the latest version Previous version: git-Purpur-2001 (MC: 1.20.1)

Other

No response

MrHua269 commented 11 months ago

https://github.com/Era4FunMC/DirtyMolia/ 来试试这个吗()

killerprojecte commented 11 months ago

I will investigate the cause and if it is caused by Dirty Folia I will fix it as a priority. If you can provide memory analysis data similar to that generated by JProfiler, it will save a lot of time for my investigation.

killerprojecte commented 11 months ago

https://github.com/Era4FunMC/DirtyMolia/ 来试试这个吗()

I think your approach to the project will be better than mine, but there are still many important features missing. DirtyFolia is more like a milestone, I have given so much to Folia, maybe it is time to leave it to the community to continue completing my original intention. This project has been maintained for 6 months and is as old as Folia.

Maybe it’s not a good idea to win over users in other people’s projects

347180440 commented 11 months ago

JProfiler analyzes the data. I'll need to research how to use it to obtain the memory analysis data you require.

killerprojecte commented 11 months ago

JProfiler analyzes the data. I'll need to research how to use it to obtain the memory analysis data you require.

I only need to get which Java classes occupy more memory, but general analysis tools can only get the occupied object classes rather than the classes that store objects. As far as I know, JProfiler can obtain similar data.

347180440 commented 11 months ago

https://github.com/Era4FunMC/DirtyMolia/ 来试试这个吗() OK 明晚在试试 我先等一份-JProfiler 分析报告

347180440 commented 11 months ago

image Current two hour data

MrHua269 commented 11 months ago

https://github.com/Era4FunMC/DirtyMolia/ 来试试这个吗()

I think your approach to the project will be better than mine, but there are still many important features missing. DirtyFolia is more like a milestone, I have given so much to Folia, maybe it is time to leave it to the community to continue completing my original intention. This project has been maintained for 6 months and is as old as Folia.

Maybe it’s not a good idea to win over users in other people’s projects

锕抱歉()

347180440 commented 11 months ago

image Current four-hour data

MrHua269 commented 11 months ago

I guess this issue can reproduce by creating many tick regions,I have seen this issue before

MrHua269 commented 11 months ago

image I think it's the problem here

killerprojecte commented 11 months ago

I will change to a more optimized solution to automatically recycle the cache when the area is not called for a long time.

MrHua269 commented 11 months ago

I will change to a more optimized solution to automatically recycle the cache when the area is not called for a long time.

I think you can save all created worlddata in folia because it won't be removed,You can find the method called getOrCreateRegionizedData in class TickRegions

347180440 commented 11 months ago

image image

killerprojecte commented 11 months ago

image image

Please test the latest version.

347180440 commented 11 months ago

Let me observe for a few days.

347180440 commented 11 months ago

Time of export: | Friday, October 6, 2023 12:51:02 AM CST JVM time: | 4h:34m 31.8 GB player 18-30 POJY1@Q6L2QBYW} (0XMW~U (F7377)WI_2L_95E$X)4W(J

killerprojecte commented 11 months ago

Try reducing the memory allocation to 16G

347180440 commented 11 months ago

java -Xmx16G -Dfolia.force-load-all-plugins=true -XX:+HeapDumpOnOutOfMemoryError -jar folia-paperclip-1.20.1-R0.1-SNAPSHOT-reobf.jar nogui 0 I add a - XX to the startup: + HeapDumpOnOutOfMemoryError The java_pid15056.hprof file 23.6GB appeared at 20:24 PM on October 07 image

347180440 commented 11 months ago

image image

347180440 commented 11 months ago

I'm uploading this file right now You can download it directly If I can't download it, I haven't finished uploading it yet http://zip100.03184.com:10002/my84_20230413_2031/java_pid15056.hprof

347180440 commented 11 months ago

And, this was a recent RAM overflow. Last night, there were 8 to 4 players AFK, with a total duration of 8 hours. The setting is still -Xmx16G. I hope these tests can be helpful to you. W6~)BSL2KD86VSFXL@%~@HP DZO2Q2`KMBHN(}@HX74@$7C K1YHU4A9J}~ML% 1O1D@(9W V(6H4)M0ST6{YTCW$RUNPAX R63E3`1)7_)$7AC}$S5S71A N{IA }RQ NEG2LR~%0F~${A

347180440 commented 11 months ago

DZO2Q2`KMBHN(}@HX74@$7C

killerprojecte commented 11 months ago

Thanks, I will check this dump carefully. I think your startup script can try to be optimized. Try aikar's JVM Flags or follow Folia's GC Setting to configure it.