mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 04:25:26 +01:00
Publicly execute the main thread at dawn
GH-684 Better handles most true deadlock situations
This commit is contained in:
parent
b0d78d461b
commit
2103c75247
@ -1,11 +1,11 @@
|
|||||||
From 3cd44a0e52ef2aa66f77783cd077eb6923ce0acc Mon Sep 17 00:00:00 2001
|
From 37f9f5c93bf615201883c1dc2daf4575865f440e Mon Sep 17 00:00:00 2001
|
||||||
From: kashike <kashike@vq.lc>
|
From: kashike <kashike@vq.lc>
|
||||||
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
||||||
Subject: [PATCH] Expose server CommandMap
|
Subject: [PATCH] Expose server CommandMap
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
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
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
|
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
|
||||||
@ -39,7 +39,7 @@ index 3b16953..07077ec 100644
|
|||||||
{
|
{
|
||||||
return server.spigot();
|
return server.spigot();
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
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
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
|
@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor;
|
||||||
@ -70,5 +70,5 @@ index a4e6894..4463ab3 100644
|
|||||||
* @see UnsafeValues
|
* @see UnsafeValues
|
||||||
* @return the unsafe values instance
|
* @return the unsafe values instance
|
||||||
--
|
--
|
||||||
2.9.3
|
2.13.0.windows.1
|
||||||
|
|
||||||
|
@ -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 <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Fri, 12 May 2017 23:34:11 -0500
|
Date: Fri, 12 May 2017 23:34:11 -0500
|
||||||
Subject: [PATCH] Properly handle async calls to restart the server
|
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
|
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
|
--- a/src/main/java/org/spigotmc/RestartCommand.java
|
||||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||||
@@ -52,36 +52,7 @@ public class RestartCommand extends Command
|
@@ -52,36 +52,7 @@ public class RestartCommand extends Command
|
||||||
@ -81,7 +107,7 @@ index 49768734d..2361f96d0 100644
|
|||||||
+ } else
|
+ } else
|
||||||
+ {
|
+ {
|
||||||
+ closeSocket();
|
+ closeSocket();
|
||||||
+ MinecraftServer.getServer().safeShutdown();
|
+ MinecraftServer.getServer().getServerThread().stop();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
Loading…
Reference in New Issue
Block a user