| 
									
										
										
										
											2020-01-22 08:00:00 +11:00
										 |  |  | From 1dbd05293adc2a599260b469cafb3138244d8cad Mon Sep 17 00:00:00 2001 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2020-01-22 08:00:00 +11:00
										 |  |  | index d112750bd..f6f21e122 100644
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | --- a/src/main/java/net/minecraft/server/World.java
 | 
					
						
							|  |  |  | +++ b/src/main/java/net/minecraft/server/World.java
 | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  | @@ -86,6 +86,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 | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  | +    public static BlockPosition lastPhysicsProblem; // Spigot
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2016-03-01 08:33:06 +11:00
										 |  |  |      public CraftWorld getWorld() { | 
					
						
							|  |  |  |          return this.world; | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  | @@ -286,7 +287,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
 | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  |                  // CraftBukkit start | 
					
						
							|  |  |  |                  if (!this.captureBlockStates) { // Don't notify clients or update physics while capturing blockstates | 
					
						
							|  |  |  |                      // Modularize client and physic updates | 
					
						
							|  |  |  | -                    notifyAndUpdatePhysics(blockposition, chunk, iblockdata1, iblockdata, iblockdata2, i);
 | 
					
						
							|  |  |  | +                    // Spigot start
 | 
					
						
							|  |  |  | +                    try {
 | 
					
						
							|  |  |  | +                        notifyAndUpdatePhysics(blockposition, chunk, iblockdata1, iblockdata, iblockdata2, i);
 | 
					
						
							|  |  |  | +                    } catch (StackOverflowError ex) {
 | 
					
						
							|  |  |  | +                        lastPhysicsProblem = new BlockPosition(blockposition);
 | 
					
						
							|  |  |  | +                    }
 | 
					
						
							|  |  |  | +                    // Spigot end
 | 
					
						
							|  |  |  |                  } | 
					
						
							|  |  |  |                  // CraftBukkit end | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  | @@ -443,6 +450,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:27:08 +11:00
										 |  |  |                  } | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  |                  // CraftBukkit end | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |                  iblockdata.doPhysics(this, blockposition, block, blockposition1, false); | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  | +            // Spigot Start
 | 
					
						
							| 
									
										
										
										
											2019-04-23 14:06:57 +10:00
										 |  |  | +            } catch (StackOverflowError ex) {
 | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  | +                lastPhysicsProblem = new BlockPosition(blockposition);
 | 
					
						
							| 
									
										
										
										
											2016-11-17 12:41:12 +11:00
										 |  |  | +                // Spigot End
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  |              } 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
 | 
					
						
							| 
									
										
										
										
											2020-01-22 08:00:00 +11:00
										 |  |  | index 8b3732202..54fa83c12 100644
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | --- a/src/main/java/org/spigotmc/WatchdogThread.java
 | 
					
						
							|  |  |  | +++ b/src/main/java/org/spigotmc/WatchdogThread.java
 | 
					
						
							| 
									
										
										
										
											2018-11-23 21:27:04 +11:00
										 |  |  | @@ -70,6 +70,13 @@ public class WatchdogThread extends Thread
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  |                  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() ); | 
					
						
							|  |  |  |                  // | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  | +                if ( net.minecraft.server.World.lastPhysicsProblem != null )
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | +                {
 | 
					
						
							|  |  |  | +                    log.log( Level.SEVERE, "------------------------------" );
 | 
					
						
							|  |  |  | +                    log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" );
 | 
					
						
							| 
									
										
										
										
											2019-02-02 11:14:44 +11:00
										 |  |  | +                    log.log( Level.SEVERE, "near " + net.minecraft.server.World.lastPhysicsProblem );
 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | +                }
 | 
					
						
							|  |  |  | +                //
 | 
					
						
							|  |  |  |                  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 ); | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | -- 
 | 
					
						
							| 
									
										
										
										
											2019-04-23 09:33:25 +10:00
										 |  |  | 2.20.1 | 
					
						
							| 
									
										
										
										
											2014-04-23 12:44:02 +01:00
										 |  |  | 
 |