Merge branch 'master' into pre/1.13

* master:
  Fix bug in last patch
  Ensure chunks are always loaded on hard position sets
  Improve Watchdog Early Warning Feature - Closes #1319
  Allow disabling armour stand ticking
This commit is contained in:
Aikar
2018-08-16 18:11:35 -04:00
11 changed files with 177 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 046bf33f66..8f12ad850b 100644
index 046bf33f66..b23d45f7df 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +0,0 @@ import org.bukkit.configuration.InvalidConfigurationException;
@@ -23,9 +23,8 @@ index 046bf33f66..8f12ad850b 100644
@@ -0,0 +0,0 @@ public class PaperConfig {
}
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
}
+
+ public static int watchdogPrintEarlyWarningEvery = 5000;
+ public static int watchdogPrintEarlyWarningDelay = 10000;
+ private static void watchdogEarlyWarning() {
@@ -33,16 +32,19 @@ index 046bf33f66..8f12ad850b 100644
+ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000);
+ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash );
+ }
}
+
public static int tabSpamIncrement = 2;
public static int tabSpamLimit = 500;
private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 74c97b5db6..da2e84c6b8 100644
index 74c97b5db6..5fdd65b083 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.a(this.n);
// Spigot start
+ org.spigotmc.WatchdogThread.hasStarted = true;
+ org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
while (this.isRunning) {
@@ -60,7 +62,7 @@ index 4ac0ab9974..0c45d75adf 100644
public static boolean bungee;
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 57a4748a30..2aff1039ad 100644
index 57a4748a30..ac6aeb875a 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -0,0 +0,0 @@ import java.lang.management.MonitorInfo;
@@ -92,16 +94,17 @@ index 57a4748a30..2aff1039ad 100644
public static void doStart(int timeoutTime, boolean restart)
@@ -0,0 +0,0 @@ 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 + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) // Paper - Add property to disable and short timeout
+ // Paper start
+ long currentTime = System.currentTimeMillis();
+ if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") )
{
+ // Paper start
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime;
+ // Don't spam short dumps
+ // Don't spam early warning dumps
+ if ( !isLongTimeout && (earlyWarningEvery <= 0 || !hasStarted || currentTime < lastEarlyWarning + earlyWarningEvery || currentTime < lastTick + earlyWarningDelay)) continue;
+ lastEarlyWarning = currentTime;
+ // Paper end
@@ -118,7 +121,8 @@ index 57a4748a30..2aff1039ad 100644
// Paper end
+ } else
+ {
+ log.log( Level.SEVERE, "The server has not responded for " + earlyWarningEvery / 1000 + " seconds! Creating thread dump");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
+ }
+ // Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
@@ -132,9 +136,21 @@ index 57a4748a30..2aff1039ad 100644
log.log( Level.SEVERE, "Entire Thread Dump:" );
ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true );
for ( ThreadInfo thread : threads )
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
{
dumpThread( thread, log );
}
+ } else {
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ }
+
+
log.log( Level.SEVERE, "------------------------------" );
if ( restart )
{
RestartCommand.restart();
}
+ if (isLongTimeout) {
break;
+ } // Paper end
}