From 6455fa4a8b117d717d51edba5badd318c6bcbf3f Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:46:33 -0700 Subject: [PATCH] Avoid issues with certain tasks not processing during sleep (#11526) --- ...h-certain-tasks-not-processing-durin.patch | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 patches/server/Avoid-issues-with-certain-tasks-not-processing-durin.patch diff --git a/patches/server/Avoid-issues-with-certain-tasks-not-processing-durin.patch b/patches/server/Avoid-issues-with-certain-tasks-not-processing-durin.patch new file mode 100644 index 0000000000..83b6041b17 --- /dev/null +++ b/patches/server/Avoid-issues-with-certain-tasks-not-processing-durin.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Sun, 27 Oct 2024 14:18:28 -0700 +Subject: [PATCH] Avoid issues with certain tasks not processing during sleep + +Execute processQueue tasks during sleep: needed for console tab completions, pre join event, etc. + +Upstream has set precedent that the bukkit scheduler will still tick during sleep, which avoids some problems +with plugins not accounting for the new sleep feature, but can still lead to others. Because of this we have disabled +sleep by default, which avoids the problem and makes it more obvious to check if this is the cause of issues when +enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads. + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop true, false); ++ } ++ // Paper end - avoid issues with certain tasks not processing during sleep + this.server.spark.executeMainThreadTasks(); // Paper - spark + this.tickConnection(); + this.server.spark.tickEnd(((double)(System.nanoTime() - lastTick) / 1000000D)); // Paper - spark +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings