CitizensDev / Citizens2

Citizens - the premier plugin and API for creating server-side NPCs in Minecraft.
https://citizensnpcs.co
Open Software License 3.0
568 stars 297 forks source link

Citizens NPCs not being cleared #2682

Closed razorrider7 closed 2 years ago

razorrider7 commented 2 years ago

One of the networks I run has had servers repeatedly crashing. The memory usage starts at around 2-2.5GB but slowly works it's way up to 8GB (what I have allocated) and then eventually crashes.

I ran a memory dump by running /heapdump dump using the HeapDump spigot plugin. I analyzed the dump in Eclipse Memory Analyzer and it found 88,648 instances of “net.citizensnpcs.nms.v1_17_R1.entity.EntityHumanNPC$PlayerNPC”, loaded by “org.bukkit.plugin.java.PluginClassLoader @ 0x60d042cb8” occupy 3,820,310,120 (62.77%) bytes. Are NPCs not getting unloaded when they should be?

Also, the log is not showing any errors, but the server is still crashing, and citizens is loading correctly otherwise. I do not know which log is from a crash, as I have restarted the server many times since for debugging, so if a full log is needed, I will need to wait for the server to crash again... otherwise, I have attached a startup log showing everything starting correctly.

Server is running on a Ryzen 9 3950X and 8GB RAM, with a few other servers that are all having the same issue. Each server has access to 1/8 processing time. There are 73 NPCs, most of which are not loaded in, as they are in an inaccessible world to players.

saves.yml config.yml latest.log

The output of command /version on my server is: This server is running Airplane version git-Airplane-99 (MC: 1.17.1 (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: e68f5c2 on HEAD) You are on the latest version! The output of command /version citizens on my server is: Citizens version 2.0.28-SNAPSHOT (build 2393)

image

mcmonkey4eva commented 2 years ago

Can you replicate the issue on Spigot or Paper? If not, it's likely to be an issue with the janky server fork you're running.

fullwall commented 2 years ago

The other thing to consider is seeing what is referencing the PlayerNPC instances (presumably the update task?)

razorrider7 commented 2 years ago

How would I check what is referencing the PlayerNPC instances? Checking if it is just airplane right now

razorrider7 commented 2 years ago

Still happens on latest paper build...

razorrider7 commented 2 years ago

com.fastasyncworldedit.bukkit.BukkitPermissionAttachmentManager seems to be referencing the instances... I take it I should bring this up with them.

razorrider7 commented 2 years ago

Alright, issue is still ongoing on latest 1.17.1 paper: This server is running Paper version git-Paper-391 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 3e73355)

Please let me know what other information you need, or if it is a FAWE issue.

mcmonkey4eva commented 2 years ago

In your previous comment you discovered it was a FAWE issue and were going to bring it up with them