[BUG] Memoty leak: entities not cleaned if you generate map with WorldBorder plugin without players
Describe the bug Map generation with WorldBorder causes memory leaks due to large number of entities and tile entities that are never cleared because the server does not tick when there are no players.
To Reproduce
- Install WorldBorder plugin
- Start map generation without players
- Generation stopped because memory is low
Expected behavior It might be worth clearing entities in the absence of players elsewhere
Logs
Screenshots
Additional context Method updateEntities() in World executed only in tick()
Environment (please complete the following information):
- Crucible Version: Last staging and rfb-support branch
- Plugins: WorldBorder
- Mods: None
- Java Version: 21
- OS: Linux
Well, now that you mention that, this is really a bug that i have faced like forever on Thermos/Crucible.
My main problem with this bug is related with items. Sometimes like thousands of items are spawned on specific chunks and the amount just increase until a players come closer to the the chunk and them all of the items are removed at once.
I think this is indeed a serious problem, not only for when generating chunks, but for chunkloaders as well.
Was taking a look on the system that manages this feature, its the "skip-entity-ticks" at the entities.yml file
And ca be disabled by changing it to false!
settings:
skip-entity-ticks: false
Its a cauldron config that will handle conditions for entities to tick.
One of them, by default, is 'tickNoPlayers == false'
So, unless the chunk is forced, these entities will, by default, not tick when not near players.
The correct approach is to change the tickNoPlayers to true. But i am not sure if its a worth approach when considering lag.
Gonna test on my server
On my server, the problem would be Items, as they would not despawn, the "Sushchestvo" as this is called, have a "inactiveTick" that is called! Some entities could override this (like items) to have an alternative aging, it would solve the items problem.
For normal entities a simillar approach could be done.
As i have disabled on my server, i am not sure if it's worth even creating the system, and i thinnk disabling the system is better for servers with chunkloaders.
Mainly because the major source of lag is usually caused by TileEntities, not entities.