Prevent the console from locing up, due to too many messages flooding it, but only notifing of issue of the server crashes

By: David <dmck2b+github@gmail.com>
This commit is contained in:
Spigot 2014-04-21 12:56:06 +01:00
parent df297a84cd
commit ad36fb0482
2 changed files with 50 additions and 25 deletions

View file

@ -0,0 +1,50 @@
From 82df31b541e31a945256feb3314a11e0c7a068f1 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
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 52ed625..ff65035 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -108,6 +108,8 @@ public abstract class World implements IBlockAccess {
protected float growthOdds = 100;
protected float modifiedOdds = 100;
private final byte chunkTickRadius;
+ public static boolean haveWeSilencedAPhysicsCrash;
+ public static String blockLocation;
public static long chunkToKey(int x, int z)
{
@@ -531,6 +533,9 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
block1.doPhysics(this, i, j, k, block);
+ } catch (StackOverflowError stackoverflowerror) { // Spigot Start
+ haveWeSilencedAPhysicsCrash = true;
+ blockLocation = i + ", " + j + ", " + k; // 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
index de08ad6..94a3d42 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -60,6 +60,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() );
//
+ if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash)
+ {
+ log.log( Level.SEVERE, "------------------------------" );
+ log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" );
+ log.log( Level.SEVERE, "near " + net.minecraft.server.World.blockLocation);
+ }
+ //
log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log );
--
1.8.3.2

View file

@ -1,25 +0,0 @@
From 68d31fb7ae5082fdb5cb31fe42304d751028a92e Mon Sep 17 00:00:00 2001
From: David <dmck2b@gmail.com>
Date: Mon, 21 Apr 2014 17:00:53 +1000
Subject: [PATCH] Swallow StackOverflowError when updating physics.
Prevents an otherwise unneeded crash.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 52ed625..6dcf6ee 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -531,6 +531,10 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
block1.doPhysics(this, i, j, k, block);
+ // Spigot start - Prevent NoClassDefFoundError and unneeded crash
+ } catch (StackOverflowError ignore) {
+ Bukkit.getLogger().severe("Encountered stack overflow whilst updating neighbours");
+ // Spigot end
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
--
1.9.1