mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Add stacktrace deobfuscation in more places (#8484)
This commit is contained in:
parent
03245caed0
commit
13f7207665
7 changed files with 98 additions and 12 deletions
|
@ -217,6 +217,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+package com.destroystokyo.paper.exception;
|
+package com.destroystokyo.paper.exception;
|
||||||
+
|
+
|
||||||
|
+import java.util.logging.Level;
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||||
+
|
+
|
||||||
|
@ -246,7 +247,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
||||||
+ ;
|
+ ;
|
||||||
+ } catch (Throwable t) {
|
+ } catch (Throwable t) {
|
||||||
+ t.printStackTrace(); // Don't want to rethrow!
|
+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow!
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
|
|
@ -2017,8 +2017,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public boolean hasEntityMoveEvent = false; // Paper
|
public boolean hasEntityMoveEvent = false; // Paper
|
||||||
+ private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
+ private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||||
}
|
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
|
||||||
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,6 +475,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ final Throwable throwable = new Throwable(reason);
|
+ final Throwable throwable = new Throwable(reason);
|
||||||
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(throwable);
|
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(throwable);
|
||||||
+ throwable.printStackTrace();
|
+ throwable.printStackTrace();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void printStackTrace(Throwable thr) {
|
||||||
|
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
|
||||||
|
+ thr.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
||||||
|
@ -522,6 +527,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
});
|
});
|
||||||
private final PacketFlow receiving;
|
private final PacketFlow receiving;
|
||||||
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
|
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
|
||||||
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (net.minecraft.server.MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot
|
||||||
|
+ if (net.minecraft.server.MinecraftServer.getServer().isDebugging()) io.papermc.paper.util.TraceUtil.printStackTrace(throwable); // Spigot // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
@ -534,6 +548,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
paperConfigurations.initializeGlobalConfiguration();
|
paperConfigurations.initializeGlobalConfiguration();
|
||||||
paperConfigurations.initializeWorldDefaultsConfiguration();
|
paperConfigurations.initializeWorldDefaultsConfiguration();
|
||||||
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
|
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
public final UUID uuid;
|
||||||
|
public boolean hasPhysicsEvent = true; // Paper
|
||||||
|
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||||
|
- return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||||
|
+ final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||||
|
+ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
|
||||||
|
+ return thr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
if (entity.isRemoved()) {
|
||||||
|
// Paper start
|
||||||
|
if (DEBUG_ENTITIES) {
|
||||||
|
- new Throwable("Tried to add entity " + entity + " but it was marked as removed already").printStackTrace(); // CraftBukkit
|
||||||
|
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("Tried to add entity " + entity + " but it was marked as removed already"); // CraftBukkit
|
||||||
|
getAddToWorldStackTrace(entity).printStackTrace();
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||||
|
@ -551,6 +589,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
});
|
});
|
||||||
final MinecraftServer server;
|
final MinecraftServer server;
|
||||||
public volatile boolean running;
|
public volatile boolean running;
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
||||||
|
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
|
||||||
|
// Paper start
|
||||||
|
if (MinecraftServer.getServer().isDebugging()) {
|
||||||
|
- exception.printStackTrace();
|
||||||
|
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception);
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||||
|
@@ -0,0 +0,0 @@ public class OldUsersConverter {
|
||||||
|
try {
|
||||||
|
root = NbtIo.readCompressed(new java.io.FileInputStream(file5));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
- exception.printStackTrace();
|
||||||
|
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
|
||||||
|
ServerInternalException.reportInternalException(exception); // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ public class OldUsersConverter {
|
||||||
|
try {
|
||||||
|
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
- exception.printStackTrace();
|
||||||
|
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
|
||||||
|
ServerInternalException.reportInternalException(exception); // Paper
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
|
||||||
|
+ " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
|
||||||
|
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
|
||||||
|
"\nWorld: " + level.getLevel().dimension().location());
|
||||||
|
- e.printStackTrace();
|
||||||
|
+ io.papermc.paper.util.TraceUtil.printStackTrace(e);
|
||||||
|
ServerInternalException.reportInternalException(e);
|
||||||
|
// Paper end
|
||||||
|
// CraftBukkit end
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
||||||
|
|
|
@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public boolean hasPhysicsEvent = true; // Paper
|
public boolean hasPhysicsEvent = true; // Paper
|
||||||
+ public boolean hasEntityMoveEvent = false; // Paper
|
+ public boolean hasEntityMoveEvent = false; // Paper
|
||||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||||
}
|
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
|
|
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
.printStackTrace();
|
+ ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
+ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Delay adding to tracker until after list packets
|
+ if (entity instanceof ServerPlayer && ((ServerPlayer) entity).supressTrackerForLogin) return; // Delay adding to tracker until after list packets
|
||||||
|
|
|
@ -5292,7 +5292,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public static void ensureMain(String reason, Runnable run) {
|
+ public static void ensureMain(String reason, Runnable run) {
|
||||||
+ if (!isMainThread()) {
|
+ if (!isMainThread()) {
|
||||||
+ if (reason != null) {
|
+ if (reason != null) {
|
||||||
+ new IllegalStateException("Asynchronous " + reason + "!").printStackTrace();
|
+ MinecraftServer.LOGGER.warn("Asynchronous " + reason + "!", new IllegalStateException());
|
||||||
+ }
|
+ }
|
||||||
+ getProcessQueue().add(run);
|
+ getProcessQueue().add(run);
|
||||||
+ return;
|
+ return;
|
||||||
|
@ -5317,7 +5317,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public static <T> T ensureMain(String reason, Supplier<T> run) {
|
+ public static <T> T ensureMain(String reason, Supplier<T> run) {
|
||||||
+ if (!isMainThread()) {
|
+ if (!isMainThread()) {
|
||||||
+ if (reason != null) {
|
+ if (reason != null) {
|
||||||
+ new IllegalStateException("Asynchronous " + reason + "! Blocking thread until it returns ").printStackTrace();
|
+ MinecraftServer.LOGGER.warn("Asynchronous " + reason + "! Blocking thread until it returns ", new IllegalStateException());
|
||||||
+ }
|
+ }
|
||||||
+ Waitable<T> wait = new Waitable<T>() {
|
+ Waitable<T> wait = new Waitable<T>() {
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -5329,7 +5329,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ try {
|
+ try {
|
||||||
+ return wait.get();
|
+ return wait.get();
|
||||||
+ } catch (InterruptedException | ExecutionException e) {
|
+ } catch (InterruptedException | ExecutionException e) {
|
||||||
+ e.printStackTrace();
|
+ MinecraftServer.LOGGER.warn("Encountered exception", e);
|
||||||
+ }
|
+ }
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -16,9 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
|
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
|
||||||
+ // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
|
+ // Paper start - ignore and warn about illegal addEntity calls instead of crashing server
|
||||||
+ if (!entity.valid || entity.level != this.level || this.entityMap.containsKey(entity.getId())) {
|
+ if (!entity.valid || entity.level != this.level || this.entityMap.containsKey(entity.getId())) {
|
||||||
+ new Throwable("[ERROR] Illegal PlayerChunkMap::addEntity for world " + this.level.getWorld().getName()
|
+ LOGGER.error("Illegal ChunkMap::addEntity for world " + this.level.getWorld().getName()
|
||||||
+ + ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""))
|
+ + ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable());
|
||||||
+ .printStackTrace();
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
Loading…
Reference in a new issue