mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
f835a91d15
Upstream has added the equivalent of our SentientNPC API, with exception to the EnderDragon. We've added Mob to the EnderDragon, and our SentientNPC API should behave the same. Vex#getOwner has been deprecated and a replacement Vex#getSummoner has been added using Mob. However, since 1.13 is not production ready, SentientNPC API is subject for removal in 1.13.1 since 1.13 API is not compatible with 1.12. Please move to the Mob interface ASAP. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: c5ab54d8 Expand GameRule API ab9a606c Improve entity hierarchy by adding Mob interface. CraftBukkit Changes:29e75648
Expand GameRule API50e6858b
Improve entity hierarchy by adding Mob interface.0e1d79b4
Correct error in previous patch
88 lines
4.4 KiB
Diff
88 lines
4.4 KiB
Diff
From 1981048ec72af6199d70617eebd09d24f9e06e94 Mon Sep 17 00:00:00 2001
|
|
From: miclebrick <miclebrick@outlook.com>
|
|
Date: Wed, 8 Aug 2018 15:30:52 -0400
|
|
Subject: [PATCH] Add 5 second short dumps to watchdog
|
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
|
index 57a4748a30..815c3e6649 100644
|
|
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
|
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
|
@@ -13,8 +13,10 @@ public class WatchdogThread extends Thread
|
|
|
|
private static WatchdogThread instance;
|
|
private final long timeoutTime;
|
|
+ private final long shortTimeout; // Paper - Timeout time for just printing a dump but not restarting
|
|
private final boolean restart;
|
|
private volatile long lastTick;
|
|
+ private long lastShortDump; // Paper - Keep track of short dump times to avoid spamming console with short dumps
|
|
private volatile boolean stopping;
|
|
|
|
private WatchdogThread(long timeoutTime, boolean restart)
|
|
@@ -22,6 +24,7 @@ public class WatchdogThread extends Thread
|
|
super( "Paper Watchdog Thread" );
|
|
this.timeoutTime = timeoutTime;
|
|
this.restart = restart;
|
|
+ shortTimeout = Math.min(5000, timeoutTime); // Paper - Make short timeout the lower of 5 seconds, and timeout time
|
|
}
|
|
|
|
public static void doStart(int timeoutTime, boolean restart)
|
|
@@ -52,9 +55,19 @@ public class WatchdogThread extends Thread
|
|
while ( !stopping )
|
|
{
|
|
//
|
|
- if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable
|
|
+ long currentTime = System.currentTimeMillis(); // Paper - do we REALLY need to call this method multiple times?
|
|
+ if ( lastTick != 0 && currentTime > lastTick + shortTimeout && !Boolean.getBoolean("disable.watchdog") ) // Paper - Add property to disable and short timeout
|
|
{
|
|
+ // Paper start
|
|
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime;
|
|
+ // Don't spam short dumps
|
|
+ if ( !isLongTimeout && currentTime < lastShortDump + shortTimeout ) continue;
|
|
+ lastShortDump = currentTime;
|
|
+ // Paper end
|
|
Logger log = Bukkit.getServer().getLogger();
|
|
+ // Paper start - Different message when it's a short timeout
|
|
+ if ( isLongTimeout )
|
|
+ {
|
|
log.log( Level.SEVERE, "The server has stopped responding!" );
|
|
log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" );
|
|
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
|
|
@@ -79,11 +92,19 @@ public class WatchdogThread extends Thread
|
|
}
|
|
}
|
|
// Paper end
|
|
+ } else
|
|
+ {
|
|
+ log.log( Level.SEVERE, "The server has not responded for " + shortTimeout / 1000 + " seconds! Creating thread dump");
|
|
+ }
|
|
+ // Paper end - Different message for short timeout
|
|
log.log( Level.SEVERE, "------------------------------" );
|
|
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" );
|
|
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log );
|
|
log.log( Level.SEVERE, "------------------------------" );
|
|
//
|
|
+ // Paper start - Only print full dump on long timeouts
|
|
+ if ( isLongTimeout )
|
|
+ {
|
|
log.log( Level.SEVERE, "Entire Thread Dump:" );
|
|
ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true );
|
|
for ( ThreadInfo thread : threads )
|
|
@@ -97,11 +118,12 @@ public class WatchdogThread extends Thread
|
|
RestartCommand.restart();
|
|
}
|
|
break;
|
|
+ } // Paper end
|
|
}
|
|
|
|
try
|
|
{
|
|
- sleep( 10000 );
|
|
+ sleep( 1000 ); // Paper - Reduce check time to every second instead of every ten seconds, more consistent and allows for short timeout
|
|
} catch ( InterruptedException ex )
|
|
{
|
|
interrupt();
|
|
--
|
|
2.18.0
|
|
|