aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason <[email protected]>2022-03-04 01:26:22 -0700
committerGitHub <[email protected]>2022-03-04 09:26:22 +0100
commitc09365aeac3afac0888eb835bdf54844544b574a (patch)
tree20a01b923e8046c037addbac7338504484d6c9a3
parent15b6b3db2cf24c98afbfb0849e694875d18fc021 (diff)
downloadPaper-c09365aeac3afac0888eb835bdf54844544b574a.tar.gz
Paper-c09365aeac3afac0888eb835bdf54844544b574a.zip
Fix deadlock on watchdog crash (#7535)
-rw-r--r--patches/server/0878-Fix-deadlock-on-watchdog-crash.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/patches/server/0878-Fix-deadlock-on-watchdog-crash.patch b/patches/server/0878-Fix-deadlock-on-watchdog-crash.patch
new file mode 100644
index 0000000000..995e8b01ac
--- /dev/null
+++ b/patches/server/0878-Fix-deadlock-on-watchdog-crash.patch
@@ -0,0 +1,21 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jason Penilla <[email protected]>
+Date: Fri, 4 Mar 2022 00:12:49 -0700
+Subject: [PATCH] Fix deadlock on watchdog crash
+
+The watchdog thread sets MinecraftServer#forceTicks to true which will
+cause waitUntilNextTick to hang when the task queue is drained.
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index d86fa3bbdc6cc838ed0ab96c2c084386dd4593e9..46a959633a88ad146e8935d297ffddee2384e275 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -1014,7 +1014,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ }, false);
+ }
+
+- this.waitUntilNextTick();
++ this.managedBlock(() -> !this.canSleepForTickNoOversleep() || this.getPendingTasksCount() == 0); // Paper - based on waitUntilNextTick
+ }
+
+ this.saveAllChunks(false, true, false);