Crucible icon indicating copy to clipboard operation
Crucible copied to clipboard

[BUG] Memoty leak: entities not cleaned if you generate map with WorldBorder plugin without players

Open gravit0 opened this issue 1 year ago • 3 comments

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

  1. Install WorldBorder plugin
  2. Start map generation without players
  3. Generation stopped because memory is low

Expected behavior It might be worth clearing entities in the absence of players elsewhere

Logs

Screenshots Screenshot_20241022_053209

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

gravit0 avatar Oct 21 '24 23:10 gravit0

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.

EverNife avatar Nov 01 '24 02:11 EverNife

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

EverNife avatar Apr 07 '25 02:04 EverNife

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.

EverNife avatar Apr 07 '25 12:04 EverNife