From 0ded25feeeb23fa2503c6daee72010980780d868 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 10 Jun 2020 23:40:28 -0400 Subject: [PATCH] Fix issues with SIGTERM not shutting down gracefully - Fixes #3062 We had 2 issues. 1) Log4J2 Shutdown hook seemed to be causing issues as it shutdown logger while we still needed it 2) ServerShutdownThread needs to stay alive until server is shutdown to keep jvm open. It appears SIGINT is handled differently than SIGTERM, as SIGINT worked correctly. But this will make both methods work. --- .../Improved-Watchdog-Support.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Spigot-Server-Patches/Improved-Watchdog-Support.patch b/Spigot-Server-Patches/Improved-Watchdog-Support.patch index 3f0a4a8c9..567c43c33 100644 --- a/Spigot-Server-Patches/Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/Improved-Watchdog-Support.patch @@ -79,6 +79,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (dedicatedserverproperties.announcePlayerAchievements != null) { ((GameRules.GameRuleBoolean) this.getGameRules().get(GameRules.ANNOUNCE_ADVANCEMENTS)).a(dedicatedserverproperties.announcePlayerAchievements, (MinecraftServer) this); } +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + //this.remoteStatusListener.b(); // Paper - don't wait for remote connections + } + ++ hasFullyShutdown = true; // Paper + System.exit(0); // CraftBukkit + } + @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @Override public void stop() { @@ -122,6 +130,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start public static final int TPS = 20; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant +- ++ + + +