From c0a3d51ab35930e410fcd9752ceaff6c3f581c24 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 3 Dec 2024 17:58:41 +0100 Subject: Start update, apply API patches --- ...0354-Wait-for-Async-Tasks-during-shutdown.patch | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 patches/unapplied/server/0354-Wait-for-Async-Tasks-during-shutdown.patch (limited to 'patches/unapplied/server/0354-Wait-for-Async-Tasks-during-shutdown.patch') diff --git a/patches/unapplied/server/0354-Wait-for-Async-Tasks-during-shutdown.patch b/patches/unapplied/server/0354-Wait-for-Async-Tasks-during-shutdown.patch new file mode 100644 index 0000000000..e26fbcde1f --- /dev/null +++ b/patches/unapplied/server/0354-Wait-for-Async-Tasks-during-shutdown.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 10 May 2020 22:16:17 -0400 +Subject: [PATCH] Wait for Async Tasks during shutdown + +Server.reload() had this logic to give time for tasks to shutdown, +however shutdown did not... + +Adds a 5 second grace period for any async tasks to finish and warns +if any are still running after that delay just as reload does. + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index c84a5bdbea0497231c78c9a0230cdf70e30a2ff3..c2ba34f6d5765fd8574a61825a6aab8fdd98a0f2 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -955,6 +955,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { ++ try { ++ Thread.sleep(100); ++ } catch (InterruptedException e) {} ++ pollCount++; ++ } ++ ++ List overdueWorkers = getScheduler().getActiveWorkers(); ++ for (BukkitWorker worker : overdueWorkers) { ++ Plugin plugin = worker.getOwner(); ++ getLogger().log(Level.SEVERE, String.format( ++ "Nag author(s): '%s' of '%s' about the following: %s", ++ plugin.getPluginMeta().getAuthors(), ++ plugin.getPluginMeta().getDisplayName(), ++ "This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies." ++ )); ++ if (console.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread(worker.getThread(), "still running"); // Paper - Debugging ++ } ++ } ++ // Paper end - Wait for Async Tasks during shutdown ++ + @Override + public void reloadData() { + ReloadCommand.reload(this.console); -- cgit v1.2.3