mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Don't process watchdog until server has fully started and ticked.
I think adjusting watchdog settings may of caused instant crashes. Fixes #3209
This commit is contained in:
parent
938bd97255
commit
3f4360296c
1 changed files with 20 additions and 20 deletions
|
@ -1,4 +1,4 @@
|
|||
From f654ac6449eed39bcdfddca723938f7073e24d6d Mon Sep 17 00:00:00 2001
|
||||
From 9366f4f3f725418e1e9533904d8eeda8fe4699a3 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 12 Apr 2020 15:50:48 -0400
|
||||
Subject: [PATCH] Forced Watchdog Crash support and Improve Async Shutdown
|
||||
|
@ -36,7 +36,7 @@ We have to ensure Thread Death propagates correctly though to stop main complete
|
|||
This is to ensure that if main isn't truely stuck, it's not manipulating state we are trying to save.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
|
||||
index 3de19c99..c7dc8787 100644
|
||||
index 3de19c998b..c7dc8787cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/CrashReport.java
|
||||
+++ b/src/main/java/net/minecraft/server/CrashReport.java
|
||||
@@ -257,6 +257,7 @@ public class CrashReport {
|
||||
|
@ -48,7 +48,7 @@ index 3de19c99..c7dc8787 100644
|
|||
throwable = throwable.getCause();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 1ef7890d..e62ca054 100644
|
||||
index 1ef7890da5..e62ca0543f 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -750,7 +750,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
|
@ -61,7 +61,7 @@ index 1ef7890d..e62ca054 100644
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 7bfadb35..99bc8da3 100644
|
||||
index 7bfadb35d2..f68494b030 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -144,6 +144,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
@ -113,14 +113,14 @@ index 7bfadb35..99bc8da3 100644
|
|||
}
|
||||
|
||||
public String getServerIp() {
|
||||
@@ -874,6 +891,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
// Spigot End
|
||||
@@ -882,6 +899,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.a(this.serverPing);
|
||||
|
||||
public void run() {
|
||||
+ boolean isThreadDeath = false; // Paper
|
||||
try {
|
||||
if (this.init()) {
|
||||
this.nextTick = SystemUtils.getMonotonicMillis();
|
||||
// Spigot start
|
||||
+ org.spigotmc.WatchdogThread.tick(); // Paper
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( recentTps, 20 );
|
||||
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
@@ -938,6 +956,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.a((CrashReport) null);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ index 7bfadb35..99bc8da3 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index dfe62515..160476fa 100644
|
||||
index dfe6251576..160476fa29 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -398,7 +398,7 @@ public abstract class PlayerList {
|
||||
|
@ -180,7 +180,7 @@ index dfe62515..160476fa 100644
|
|||
|
||||
// Paper start - Remove from collideRule team if needed
|
||||
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
index dc6d0306..bc8b9046 100644
|
||||
index dc6d030621..bc8b904660 100644
|
||||
--- a/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
@@ -109,6 +109,7 @@ public class SystemUtils {
|
||||
|
@ -192,7 +192,7 @@ index dc6d0306..bc8b9046 100644
|
|||
SystemUtils.c.shutdown();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index d554d4cf..46e19d91 100644
|
||||
index d554d4cf0f..46e19d916c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -786,6 +786,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
@ -212,7 +212,7 @@ index d554d4cf..46e19d91 100644
|
|||
String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ();
|
||||
System.err.println(msg);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8cc0f66c..dcc44be6 100644
|
||||
index 8cc0f66ce5..dcc44be613 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1705,7 +1705,7 @@ public final class CraftServer implements Server {
|
||||
|
@ -225,7 +225,7 @@ index 8cc0f66c..dcc44be6 100644
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
index 449e99d1..899a5252 100644
|
||||
index 449e99d1b6..899a525209 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
@@ -12,12 +12,25 @@ public class ServerShutdownThread extends Thread {
|
||||
|
@ -256,7 +256,7 @@ index 449e99d1..899a5252 100644
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
index aefea3a9..123de5ac 100644
|
||||
index aefea3a9a8..123de5ac90 100644
|
||||
--- a/src/main/java/org/spigotmc/RestartCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
@@ -139,7 +139,7 @@ public class RestartCommand extends Command
|
||||
|
@ -269,7 +269,7 @@ index aefea3a9..123de5ac 100644
|
|||
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 5bdcdcf9..acc880c7 100644
|
||||
index 5bdcdcf9e8..963bd001f4 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -67,12 +67,13 @@ public class WatchdogThread extends Thread
|
||||
|
@ -278,7 +278,7 @@ index 5bdcdcf9..acc880c7 100644
|
|||
long currentTime = monotonicMillis();
|
||||
- if ( lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") )
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+ if ( !server.isRunning() || (lastTick != 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog")) )
|
||||
+ if (lastTick != 0 && hasStarted && (!server.isRunning() || (currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog")) ))
|
||||
{
|
||||
- boolean isLongTimeout = currentTime > lastTick + timeoutTime;
|
||||
+ boolean isLongTimeout = currentTime > lastTick + timeoutTime || (!server.isRunning() && !server.hasStopped() && currentTime > lastTick + 1000);
|
||||
|
@ -326,5 +326,5 @@ index 5bdcdcf9..acc880c7 100644
|
|||
break;
|
||||
} // Paper end
|
||||
--
|
||||
2.25.1.windows.1
|
||||
2.25.1
|
||||
|
||||
|
|
Loading…
Reference in a new issue