2019-08-05 18:35:40 +02:00
From aeef538a6f37143d4cacf2d4c66298232d6a19e4 Mon Sep 17 00:00:00 2001
2019-05-17 00:27:36 +02:00
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 13 May 2019 21:10:59 -0700
Subject: [PATCH] Fix CraftServer#isPrimaryThread and MinecraftServer
isMainThread
md_5 changed it so he could shut down the server asynchronously
from watchdog, although we have patches that prevent that type
of behavior for this exact reason.
md_5 also placed code in PlayerConnectionUtils that would have
solved https://bugs.mojang.com/browse/MC-142590, making the change
to MinecraftServer#isMainThread irrelevant.
2019-05-18 07:01:44 +02:00
By reverting his change to MinecraftServer#isMainThread packet
handling that should have been handled synchronously will be handled
2019-05-17 00:27:36 +02:00
synchronously when the server gets shut down.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
2019-08-05 18:35:40 +02:00
index 35c5d38c21..c70ab3caf0 100644
2019-05-17 00:27:36 +02:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2019-07-24 05:20:14 +02:00
@@ -2154,7 +2154,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
2019-05-17 00:27:36 +02:00
// CraftBukkit start
@Override
public boolean isMainThread() {
- return super.isMainThread() || this.isStopped(); // CraftBukkit - MC-142590
+ return super.isMainThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere
}
@Deprecated
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-08-05 18:35:40 +02:00
index b89486beb1..7a8ab7d401 100644
2019-05-17 00:27:36 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-08-05 18:35:40 +02:00
@@ -1664,7 +1664,7 @@ public final class CraftServer implements Server {
2019-05-17 00:27:36 +02:00
@Override
public boolean isPrimaryThread() {
- return Thread.currentThread().equals(console.serverThread) || console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
+ return Thread.currentThread().equals(console.serverThread); // Paper - Fix issues with detecting main thread properly
}
@Override
--
2019-06-25 03:47:58 +02:00
2.22.0
2019-05-17 00:27:36 +02:00