From c65dcad3eba5362493c31b5f2f23c1277c287373 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 12 Apr 2020 00:42:28 -0400 Subject: [PATCH] Don't delay chunk unloads during entity ticking Leaf informed me this could cause ordering issues. So, the risk if this occurring is lowered now anyways, but if an entity causes a sync chunk load, it could process an unload... We will tackle the problem better in a future commit Also fixed another async-chunks=false issue --- ...391-Asynchronous-chunk-IO-and-loading.patch | 6 +++--- ...tions-until-after-entity-ticking-is-d.patch | 18 +----------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Spigot-Server-Patches/0391-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0391-Asynchronous-chunk-IO-and-loading.patch index 89211c348..fbfef2928 100644 --- a/Spigot-Server-Patches/0391-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0391-Asynchronous-chunk-IO-and-loading.patch @@ -1,4 +1,4 @@ -From 8507a6807398fadc4ead7cc3c3089a62d36aec06 Mon Sep 17 00:00:00 2001 +From 6e4b6c3681b093e95db973304a8cd0b04880cb76 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 13 Jul 2019 09:23:10 -0700 Subject: [PATCH] Asynchronous chunk IO and loading @@ -1902,7 +1902,7 @@ index 0000000000..1dfa8abfd8 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java new file mode 100644 -index 0000000000..ff19d38f82 +index 0000000000..0745a2015a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java @@ -0,0 +1,492 @@ @@ -2297,7 +2297,7 @@ index 0000000000..ff19d38f82 + worker.flush(); + } + } -+ globalUrgentWorker.flush(); ++ if (globalUrgentWorker != null) globalUrgentWorker.flush(); + + // flush again since tasks we execute async saves + drainChunkWaitQueue(); diff --git a/Spigot-Server-Patches/0467-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch b/Spigot-Server-Patches/0467-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch index 61172e5ce..a70f685ea 100644 --- a/Spigot-Server-Patches/0467-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch +++ b/Spigot-Server-Patches/0467-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch @@ -1,26 +1,10 @@ -From aa1a9266fcdeb4ffc727142df482ebca0d03828d Mon Sep 17 00:00:00 2001 +From 659e3b03a4d6f5e691a516535bbff7b8bf52aba4 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 11 Apr 2020 21:23:42 -0400 Subject: [PATCH] Delay unsafe actions until after entity ticking is done This will help prevent many cases of unregistering entities during entity ticking -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index a9a2ce3d3f..24cb88559b 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -490,8 +490,11 @@ public class PlayerChunk { - // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick - // lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag. - // These actions may however happen deferred, so we manually set the needsSaving flag already here. -+ // Paper start -+ ((WorldServer) chunk.world).doIfNotEntityTicking(() -> { // Paper - chunk.setNeedsSaving(true); - chunk.unloadCallback(); -+ }); // Paper - }); - } - }).exceptionally((throwable) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index cd8266f675..84a3367b87 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java