Make watchdog thread extend TickThread again

This commit is contained in:
Nassim Jahnke 2024-07-14 13:58:27 +02:00
parent 2288e13816
commit 1595e4afc0
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
3 changed files with 18 additions and 9 deletions

View file

@ -35945,9 +35945,18 @@ index e8e3cc48cf1c58bd8151d1f28df28781859cd0e3..67c8e90d3a2a93d858371d7fc1c3aaac
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper
throw new IllegalStateException( "Asynchronous " + reason + "!" );
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index ad282d34919716b75acd10426cd071da9d064a51..7507e3058e7519a3e13b3be061746151a71b8f20 100644
index ad282d34919716b75acd10426cd071da9d064a51..bab2bd91528a8b2e9e74a3f9eb061d52619102f6 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -8,7 +8,7 @@ import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
-public class WatchdogThread extends Thread
+public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper - rewrite chunk system
{
private static WatchdogThread instance;
@@ -115,6 +115,7 @@ public class WatchdogThread extends Thread
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );

View file

@ -357,18 +357,18 @@ index 39e56b95aaafbcd8ebe68fdefaace83702e9510d..3ba27955548a26367a87d6b87c3c61be
String[] split = restartScript.split( " " );
if ( split.length > 0 && new File( split[0] ).isFile() )
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 7507e3058e7519a3e13b3be061746151a71b8f20..e5e41dc2d4f7a8c3fea704212507ca0b951664db 100644
index bab2bd91528a8b2e9e74a3f9eb061d52619102f6..8ef5c345b7ba5ef869a1b0468f431c0f47cf2319 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
public class WatchdogThread extends Thread
public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper - rewrite chunk system
{
+ public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper - Improved watchdog support
private static WatchdogThread instance;
private long timeoutTime;
private boolean restart;
@@ -39,6 +40,7 @@ public class WatchdogThread extends Thread
@@ -39,6 +40,7 @@ public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper -
{
if ( WatchdogThread.instance == null )
{
@ -376,7 +376,7 @@ index 7507e3058e7519a3e13b3be061746151a71b8f20..e5e41dc2d4f7a8c3fea704212507ca0b
WatchdogThread.instance = new WatchdogThread( timeoutTime * 1000L, restart );
WatchdogThread.instance.start();
} else
@@ -70,12 +72,13 @@ public class WatchdogThread extends Thread
@@ -70,12 +72,13 @@ public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper -
// Paper start
Logger log = Bukkit.getServer().getLogger();
long currentTime = WatchdogThread.monotonicMillis();
@ -393,7 +393,7 @@ index 7507e3058e7519a3e13b3be061746151a71b8f20..e5e41dc2d4f7a8c3fea704212507ca0b
lastEarlyWarning = currentTime;
if (isLongTimeout) {
// Paper end
@@ -136,9 +139,24 @@ public class WatchdogThread extends Thread
@@ -136,9 +139,24 @@ public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper -
if ( isLongTimeout )
{

View file

@ -204,10 +204,10 @@ index 5608576f461ce9dec9827f9f581adc5d5757baf1..be9976a994dd04cf53048567576dd348
int j = Mth.floor(y);
int k = Mth.floor(z);
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index e5e41dc2d4f7a8c3fea704212507ca0b951664db..f947b542b21189ab8324d54d965364aa283d7cb7 100644
index 8ef5c345b7ba5ef869a1b0468f431c0f47cf2319..5e583d7226ce60d965ce9f019900793d45742d30 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -22,6 +22,78 @@ public class WatchdogThread extends Thread
@@ -22,6 +22,78 @@ public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper -
private volatile long lastTick;
private volatile boolean stopping;
@ -286,7 +286,7 @@ index e5e41dc2d4f7a8c3fea704212507ca0b951664db..f947b542b21189ab8324d54d965364aa
private WatchdogThread(long timeoutTime, boolean restart)
{
super( "Paper Watchdog Thread" );
@@ -119,6 +191,7 @@ public class WatchdogThread extends Thread
@@ -119,6 +191,7 @@ public class WatchdogThread extends io.papermc.paper.util.TickThread // Paper -
log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - rewrite chunk system