aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZach Brown <[email protected]>2017-05-13 05:51:09 -0500
committerZach Brown <[email protected]>2017-05-13 06:08:09 -0500
commit2103c75247529cad3c9765120b9c285a3e65793c (patch)
tree9e4325ffb3245bb35be915c3ea802f759c570fb2
parentb0d78d461b4037459d393528faa699d0b4fe9b46 (diff)
downloadPaper-2103c75247529cad3c9765120b9c285a3e65793c.tar.gz
Paper-2103c75247529cad3c9765120b9c285a3e65793c.zip
Publicly execute the main thread at dawn
GH-684 Better handles most true deadlock situations
-rw-r--r--Spigot-API-Patches/0015-Expose-server-CommandMap.patch8
-rw-r--r--Spigot-Server-Patches/0211-Properly-handle-async-calls-to-restart-the-server.patch32
2 files changed, 33 insertions, 7 deletions
diff --git a/Spigot-API-Patches/0015-Expose-server-CommandMap.patch b/Spigot-API-Patches/0015-Expose-server-CommandMap.patch
index 7cd26b2806..557e8f2e56 100644
--- a/Spigot-API-Patches/0015-Expose-server-CommandMap.patch
+++ b/Spigot-API-Patches/0015-Expose-server-CommandMap.patch
@@ -1,11 +1,11 @@
-From 3cd44a0e52ef2aa66f77783cd077eb6923ce0acc Mon Sep 17 00:00:00 2001
+From 37f9f5c93bf615201883c1dc2daf4575865f440e Mon Sep 17 00:00:00 2001
From: kashike <[email protected]>
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
-index 3b16953..07077ec 100644
+index 3b16953a..07077ec4 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
@@ -39,7 +39,7 @@ index 3b16953..07077ec 100644
{
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
-index a4e6894..4463ab3 100644
+index a4e68943..4463ab33 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
@@ -70,5 +70,5 @@ index a4e6894..4463ab3 100644
* @see UnsafeValues
* @return the unsafe values instance
--
-2.9.3
+2.13.0.windows.1
diff --git a/Spigot-Server-Patches/0211-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0211-Properly-handle-async-calls-to-restart-the-server.patch
index 1797044dcd..3f77fc3253 100644
--- a/Spigot-Server-Patches/0211-Properly-handle-async-calls-to-restart-the-server.patch
+++ b/Spigot-Server-Patches/0211-Properly-handle-async-calls-to-restart-the-server.patch
@@ -1,11 +1,37 @@
-From 707945410e0af095ceb20fde3ce0eaf085c36c8c Mon Sep 17 00:00:00 2001
+From 2aa53ac9f67c953bdeac7f66834cdf8fb343799d Mon Sep 17 00:00:00 2001
From: Zach Brown <[email protected]>
Date: Fri, 12 May 2017 23:34:11 -0500
Subject: [PATCH] Properly handle async calls to restart the server
+The watchdog thread calls the server restart function asynchronously. Prior to
+this change, it attempted to do several non-safe operations from the watchdog
+thread, rather than the main. Specifically, because of a separate upstream change,
+it causes player entities to be ticked asynchronously, among other things.
+This is dangerous.
+
+This patch moves the old handling into a synchronous variant, for calls from the
+restart command, and adds separate handling for async calls, such as those from
+the watchdog thread.
+
+When calling from the watchdog thread, we cannot assume the main thread is in a
+tickable state; it may be completely deadlocked. Therefore, we kill that thread
+right then and there.
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index 8df30e3d0..df3077c9d 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -1630,6 +1630,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
+ return this.ab;
+ }
+
++ public final Thread getServerThread() { return this.aI(); } // Paper - OBFHELPER
+ public Thread aI() {
+ return this.serverThread;
+ }
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
-index 49768734d..2361f96d0 100644
+index 49768734d..35c828805 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -52,36 +52,7 @@ public class RestartCommand extends Command
@@ -81,7 +107,7 @@ index 49768734d..2361f96d0 100644
+ } else
+ {
+ closeSocket();
-+ MinecraftServer.getServer().safeShutdown();
++ MinecraftServer.getServer().getServerThread().stop();
+ }
+ }
+