Updated Upstream (Bukkit/Spigot) (#5048)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
bf617659 SPIGOT-6313: Revert "SPIGOT-6274: Reloading configuration does not clear previous values"
e8fa7a07 SPIGOT-6274: Reloading configuration does not clear previous values

Spigot Changes:
5fc0fb4e SPIGOT-6306: Handle watchdog reloads and disabling by 0/negative times
This commit is contained in:
Jake Potrebic
2021-01-12 12:06:27 -08:00
parent c762d416c5
commit f3cfe62211
5 changed files with 14 additions and 14 deletions

View File

@@ -93,16 +93,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
private static WatchdogThread instance; private static WatchdogThread instance;
private final long timeoutTime; private long timeoutTime;
private boolean restart;
+ private final long earlyWarningEvery; // Paper - Timeout time for just printing a dump but not restarting + private final long earlyWarningEvery; // Paper - Timeout time for just printing a dump but not restarting
+ private final long earlyWarningDelay; // Paper + private final long earlyWarningDelay; // Paper
+ public static volatile boolean hasStarted; // Paper + public static volatile boolean hasStarted; // Paper
+ private long lastEarlyWarning; // Paper - Keep track of short dump times to avoid spamming console with short dumps + private long lastEarlyWarning; // Paper - Keep track of short dump times to avoid spamming console with short dumps
private final boolean restart;
private volatile long lastTick; private volatile long lastTick;
private volatile boolean stopping; private volatile boolean stopping;
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
super( "Paper Watchdog Thread" ); super( "Paper Watchdog Thread" );
this.timeoutTime = timeoutTime; this.timeoutTime = timeoutTime;
@@ -117,11 +117,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
while ( !stopping ) while ( !stopping )
{ {
- // - //
- if ( lastTick != 0 && monotonicMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable - if ( lastTick != 0 && timeoutTime > 0 && monotonicMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable
+ // Paper start + // Paper start
+ Logger log = Bukkit.getServer().getLogger(); + Logger log = Bukkit.getServer().getLogger();
+ long currentTime = monotonicMillis(); + long currentTime = monotonicMillis();
+ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) + if ( lastTick != 0 && timeoutTime > 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") )
{ {
- Logger log = Bukkit.getServer().getLogger(); - Logger log = Bukkit.getServer().getLogger();
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime; + boolean isLongTimeout = currentTime > lastTick + timeoutTime;

View File

@@ -504,8 +504,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper + public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper
private static WatchdogThread instance; private static WatchdogThread instance;
private final long timeoutTime; private long timeoutTime;
private final long earlyWarningEvery; // Paper - Timeout time for just printing a dump but not restarting private boolean restart;
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
{ {
if ( instance == null ) if ( instance == null )
@@ -513,14 +513,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (timeoutTime <= 0) timeoutTime = 300; // Paper + if (timeoutTime <= 0) timeoutTime = 300; // Paper
instance = new WatchdogThread( timeoutTime * 1000L, restart ); instance = new WatchdogThread( timeoutTime * 1000L, restart );
instance.start(); instance.start();
} } else
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
// Paper start // Paper start
Logger log = Bukkit.getServer().getLogger(); Logger log = Bukkit.getServer().getLogger();
long currentTime = monotonicMillis(); long currentTime = monotonicMillis();
- if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) - if ( lastTick != 0 && timeoutTime > 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") )
+ MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = MinecraftServer.getServer();
+ if (lastTick != 0 && hasStarted && (!server.isRunning() || (currentTime > lastTick + earlyWarningEvery && !DISABLE_WATCHDOG) )) + if (lastTick != 0 && timeoutTime > 0 && hasStarted && (!server.isRunning() || (currentTime > lastTick + earlyWarningEvery && !DISABLE_WATCHDOG) ))
{ {
- boolean isLongTimeout = currentTime > lastTick + timeoutTime; - boolean isLongTimeout = currentTime > lastTick + timeoutTime;
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime || (!server.isRunning() && !server.hasStopped() && currentTime > lastTick + 1000); + boolean isLongTimeout = currentTime > lastTick + timeoutTime || (!server.isRunning() && !server.hasStopped() && currentTime > lastTick + 1000);

View File

@@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
while ( !stopping ) while ( !stopping )
{ {
// //
- if ( lastTick != 0 && monotonicMillis() > lastTick + timeoutTime ) - if ( lastTick != 0 && timeoutTime > 0 && monotonicMillis() > lastTick + timeoutTime )
+ if ( lastTick != 0 && monotonicMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable + if ( lastTick != 0 && timeoutTime > 0 && monotonicMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable
{ {
Logger log = Bukkit.getServer().getLogger(); Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "------------------------------" );