spigot/CraftBukkit-Patches/0060-Prevent-NoClassDefError-crash-and-notify-on-crash.patch

66 lines
3.6 KiB
Diff
Raw Normal View History

From b80b3ea8d262c82d2d80d776bc26060be94e3d16 Mon Sep 17 00:00:00 2001
From: David <dmck2b@gmail.com>
Date: Mon, 21 Apr 2014 12:43:08 +0100
Subject: [PATCH] Prevent NoClassDefError crash and notify on crash
2021-03-16 09:00:00 +11:00
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
2021-10-05 12:35:38 +11:00
index b0dbbab9a..a560b7065 100644
2021-03-16 09:00:00 +11:00
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
2021-10-05 12:35:38 +11:00
@@ -149,6 +149,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
2019-04-23 12:00:00 +10:00
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
2016-03-01 08:33:06 +11:00
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
+ public static BlockPosition lastPhysicsProblem; // Spigot
2016-03-01 08:33:06 +11:00
public CraftWorld getWorld() {
return this.world;
2021-10-05 12:35:38 +11:00
@@ -365,7 +366,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start
if (!this.captureBlockStates) { // Don't notify clients or update physics while capturing blockstates
// Modularize client and physic updates
2020-07-07 09:40:59 +10:00
- notifyAndUpdatePhysics(blockposition, chunk, iblockdata1, iblockdata, iblockdata2, i, j);
+ // Spigot start
+ try {
2020-07-07 09:40:59 +10:00
+ notifyAndUpdatePhysics(blockposition, chunk, iblockdata1, iblockdata, iblockdata2, i, j);
+ } catch (StackOverflowError ex) {
+ lastPhysicsProblem = new BlockPosition(blockposition);
+ }
+ // Spigot end
}
// CraftBukkit end
2021-10-05 12:35:38 +11:00
@@ -524,6 +531,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// CraftBukkit end
2019-04-23 12:00:00 +10:00
iblockdata.doPhysics(this, blockposition, block, blockposition1, false);
+ // Spigot Start
+ } catch (StackOverflowError ex) {
+ lastPhysicsProblem = new BlockPosition(blockposition);
2016-11-17 12:41:12 +11:00
+ // Spigot End
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
2021-03-16 09:00:00 +11:00
index 4734d4ae8..b4eeeb0d0 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -74,6 +74,13 @@ public class WatchdogThread extends Thread
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
//
2021-03-16 09:00:00 +11:00
+ if ( net.minecraft.world.level.World.lastPhysicsProblem != null )
+ {
+ log.log( Level.SEVERE, "------------------------------" );
+ log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" );
2021-03-16 09:00:00 +11:00
+ log.log( Level.SEVERE, "near " + net.minecraft.world.level.World.lastPhysicsProblem );
+ }
+ //
log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
2019-04-23 12:00:00 +10:00
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
--
2.25.1