From db9534bfdfa25414fb959a5135e9d4c6a2bab847 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 25 May 2020 13:09:56 -0400 Subject: [PATCH] One more to seal the deal to improve unloading inactive chunks While last was mostly there, still had some slight risk of unloading before it was fully finished. So just going to bump the delay to 3 minutes to be safe. Better than forever at least. Was really hoping we could unload them as soon as they were done to any memory prematurely promoting to old generation, but guess we can't. --- .../Unload-leaked-Cached-Chunks.patch | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Unload-leaked-Cached-Chunks.patch b/Spigot-Server-Patches/Unload-leaked-Cached-Chunks.patch index 4eed41cb0a..02f5df65ab 100644 --- a/Spigot-Server-Patches/Unload-leaked-Cached-Chunks.patch +++ b/Spigot-Server-Patches/Unload-leaked-Cached-Chunks.patch @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - remove inaccessible chunks leaked + else if (playerchunk.getTicketLevel() == playerchunk.oldTicketLevel && + playerChunkMap.unloadQueue.size() < 100 && -+ (playerchunk.lastActivity == 0 || world.getTime() - playerchunk.lastActivity > 20*15) && ++ (playerchunk.lastActivity == 0 || world.getTime() - playerchunk.lastActivity > 20*180) && + PlayerChunk.getChunkState(playerchunk.getTicketLevel()) == PlayerChunk.State.INACCESSIBLE + ) { + ChunkStatus chunkHolderStatus = playerchunk.getChunkHolderStatus(); @@ -87,6 +87,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ChunkStatus chunkstatus = (ChunkStatus) intfunction.apply(j1); CompletableFuture> completablefuture = playerchunk.a(chunkstatus, this); +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + if (requestingNeighbor != null && requestingNeighbor != playerchunk && !completablefuture.isDone()) { + requestingNeighbor.onNeighborRequest(playerchunk, chunkstatus); + completablefuture.thenAccept(either -> { ++ playerchunk.lastActivity = world.getTime(); // Paper - chunk leak + requestingNeighbor.onNeighborDone(playerchunk, chunkstatus, either.left().orElse(null)); + }); + } @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { while (longiterator.hasNext()) { // Spigot long j = longiterator.nextLong();