mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-21 11:55:11 +01:00
Log traces of tick threads that fail to shut down (#10)
* Log traces of threads that fail to shut down in SchedulerThreadPool
This commit is contained in:
parent
ed7a5c57f4
commit
fbf832bc05
@ -921,15 +921,16 @@ index 1e98f778ffa0a7bb00ebccaaa8bde075183e41f0..aebe82cbe8bc20e5f4260a871d7b620e
|
|||||||
*/
|
*/
|
||||||
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..f579ad58ea7db20d6d7b89abbab3a4dfadaaeaee
|
index 0000000000000000000000000000000000000000..0ce825d7af2a1dbeac5c22640534ee1901edce20
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
+++ b/src/main/java/ca/spottedleaf/concurrentutil/scheduler/SchedulerThreadPool.java
|
||||||
@@ -0,0 +1,534 @@
|
@@ -0,0 +1,543 @@
|
||||||
+package ca.spottedleaf.concurrentutil.scheduler;
|
+package ca.spottedleaf.concurrentutil.scheduler;
|
||||||
+
|
+
|
||||||
+import ca.spottedleaf.concurrentutil.util.ConcurrentUtil;
|
+import ca.spottedleaf.concurrentutil.util.ConcurrentUtil;
|
||||||
+import ca.spottedleaf.concurrentutil.util.TimeUtil;
|
+import ca.spottedleaf.concurrentutil.util.TimeUtil;
|
||||||
+import com.mojang.logging.LogUtils;
|
+import com.mojang.logging.LogUtils;
|
||||||
|
+import io.papermc.paper.util.TraceUtil;
|
||||||
+import io.papermc.paper.util.set.LinkedSortedSet;
|
+import io.papermc.paper.util.set.LinkedSortedSet;
|
||||||
+import org.slf4j.Logger;
|
+import org.slf4j.Logger;
|
||||||
+import java.lang.invoke.VarHandle;
|
+import java.lang.invoke.VarHandle;
|
||||||
@ -1031,6 +1032,14 @@ index 0000000000000000000000000000000000000000..f579ad58ea7db20d6d7b89abbab3a4df
|
|||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ public void dumpAliveThreadTraces(final String reason) {
|
||||||
|
+ for (final Thread thread : this.threads) {
|
||||||
|
+ if (thread.isAlive()) {
|
||||||
|
+ TraceUtil.dumpTraceForThread(thread, reason);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Returns an array of the underlying scheduling threads.
|
+ * Returns an array of the underlying scheduling threads.
|
||||||
+ */
|
+ */
|
||||||
@ -3626,10 +3635,10 @@ index 0000000000000000000000000000000000000000..d9687722e02dfd4088c7030abbf5008e
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java b/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java
|
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java b/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..6c288d1db81c4d6f574674889a98553baf9b86ee
|
index 0000000000000000000000000000000000000000..1bfda654d7cb79504058b591d460bfef79f0c951
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java
|
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionShutdownThread.java
|
||||||
@@ -0,0 +1,174 @@
|
@@ -0,0 +1,175 @@
|
||||||
+package io.papermc.paper.threadedregions;
|
+package io.papermc.paper.threadedregions;
|
||||||
+
|
+
|
||||||
+import com.mojang.logging.LogUtils;
|
+import com.mojang.logging.LogUtils;
|
||||||
@ -3762,6 +3771,7 @@ index 0000000000000000000000000000000000000000..6c288d1db81c4d6f574674889a98553b
|
|||||||
+ LOGGER.info("Scheduler halted");
|
+ LOGGER.info("Scheduler halted");
|
||||||
+ } else {
|
+ } else {
|
||||||
+ LOGGER.warn("Scheduler did not terminate within 60s, proceeding with shutdown anyways");
|
+ LOGGER.warn("Scheduler did not terminate within 60s, proceeding with shutdown anyways");
|
||||||
|
+ TickRegions.getScheduler().dumpAliveThreadTraces("Did not shut down in time");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ MinecraftServer.getServer().stopServer(); // stop part 1: most logic, kicking players, plugins, etc
|
+ MinecraftServer.getServer().stopServer(); // stop part 1: most logic, kicking players, plugins, etc
|
||||||
@ -7631,10 +7641,10 @@ index 0000000000000000000000000000000000000000..29f9fed5f02530b3256e6b993e607d46
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..3f14eda409ca49095dc43796868435b705c36ce4
|
index 0000000000000000000000000000000000000000..9a729994cc7d51d5e5fcb78e32d3a97d39d04611
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
||||||
@@ -0,0 +1,559 @@
|
@@ -0,0 +1,563 @@
|
||||||
+package io.papermc.paper.threadedregions;
|
+package io.papermc.paper.threadedregions;
|
||||||
+
|
+
|
||||||
+import ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool;
|
+import ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool;
|
||||||
@ -7791,6 +7801,10 @@ index 0000000000000000000000000000000000000000..3f14eda409ca49095dc43796868435b7
|
|||||||
+ return this.scheduler.halt(sync, maxWaitNS);
|
+ return this.scheduler.halt(sync, maxWaitNS);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ void dumpAliveThreadTraces(final String reason) {
|
||||||
|
+ this.scheduler.dumpAliveThreadTraces(reason);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public void setHasTasks(final RegionScheduleHandle region) {
|
+ public void setHasTasks(final RegionScheduleHandle region) {
|
||||||
+ this.scheduler.notifyTasks(region);
|
+ this.scheduler.notifyTasks(region);
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
Reference in New Issue
Block a user