Nature's Aura

Nature's Aura

34M Downloads

Deferred Chunk tracking leak

someaddons opened this issue ยท 1 comments

commented

The way your deferred chunk tracking works it is possible for the watched chunk to become unloaded before its sent to the player, which causes the deferred chunk tracking to keep the chunk forever. This builds up the size of the PENDING_AURA_CHUNKS map, and creates the occasionally reported tick lag on aura chunks, the more players and the larger the server the more likely you are to notice/encounter this.

private boolean handleChunkWatchDeferred(Player player, ChunkPos pos) {

I recommend to simply not defer the lookup, at the point the event gets fired the chunk is fully loaded and the event is only ever fired on the main server thread. (Not sure if that was different a couple years ago, but nowadays it is)

commented

There used to be a good reason to do this but I forget what it was now - it might just not be necessary anymore! Even if it is still necessary though, there should definitely be some cleanup of the list when a player disconnects as well as when a chunk gets unloaded, so this is a really good catch, thanks!!