misc debugging dumps

This commit is contained in:
Shane Freeder
2021-02-18 20:23:28 +00:00
parent e058d38078
commit 35b7f788a9
5 changed files with 105 additions and 59 deletions

View File

@@ -0,0 +1,25 @@
package io.papermc.paper.util;
import org.bukkit.Bukkit;
public final class TraceUtil {
public static void dumpTraceForThread(Thread thread, String reason) {
Bukkit.getLogger().warning(thread.getName() + ": " + reason);
StackTraceElement[] trace = StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(thread.getStackTrace());
for (StackTraceElement traceElement : trace) {
Bukkit.getLogger().warning("\tat " + traceElement);
}
}
public static void dumpTraceForThread(String reason) {
final Throwable thr = new Throwable(reason);
StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
thr.printStackTrace();
}
public static void printStackTrace(Throwable thr) {
StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
thr.printStackTrace();
}
}

View File

@@ -1051,6 +1051,7 @@ public final class CraftServer implements Server {
plugin.getDescription().getFullName(),
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
));
if (console.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread(worker.getThread(), "still running"); // Paper - Debugging
}
io.papermc.paper.plugin.PluginInitializerManager.reload(this.console); // Paper
this.loadPlugins();