Don't intercept catastrophic errors such as ThreadDeath and OOM.
May fix ticket 206.
Dieser Commit ist enthalten in:
Ursprung
d76d4247b0
Commit
bd3a60b7eb
@ -41,7 +41,7 @@ public class Application {
|
|||||||
if (primaryMethod) {
|
if (primaryMethod) {
|
||||||
try {
|
try {
|
||||||
return Bukkit.isPrimaryThread();
|
return Bukkit.isPrimaryThread();
|
||||||
} catch (Throwable e) {
|
} catch (LinkageError e) {
|
||||||
primaryMethod = false;
|
primaryMethod = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
initializeCommands();
|
initializeCommands();
|
||||||
setupBroadcastUsers(PERMISSION_INFO);
|
setupBroadcastUsers(PERMISSION_INFO);
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportDetailed(this, Report.newBuilder(REPORT_PLUGIN_LOAD_ERROR).error(e).callerParam(protocolManager));
|
reporter.reportDetailed(this, Report.newBuilder(REPORT_PLUGIN_LOAD_ERROR).error(e).callerParam(protocolManager));
|
||||||
disablePlugin();
|
disablePlugin();
|
||||||
@ -263,6 +267,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
case PACKET:
|
case PACKET:
|
||||||
commandPacket = new CommandPacket(reporter, this, logger, commandFilter, protocolManager); break;
|
commandPacket = new CommandPacket(reporter, this, logger, commandFilter, protocolManager); break;
|
||||||
}
|
}
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_REGISTER_COMMAND).
|
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_REGISTER_COMMAND).
|
||||||
messageParam(command.name(), e.getMessage()).error(e));
|
messageParam(command.name(), e.getMessage()).error(e));
|
||||||
@ -395,6 +403,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
// It also performs the update check.
|
// It also performs the update check.
|
||||||
createPacketTask(server);
|
createPacketTask(server);
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportDetailed(this, Report.newBuilder(REPORT_PLUGIN_ENABLE_ERROR).error(e));
|
reporter.reportDetailed(this, Report.newBuilder(REPORT_PLUGIN_ENABLE_ERROR).error(e));
|
||||||
disablePlugin();
|
disablePlugin();
|
||||||
@ -406,6 +418,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
if (config.isMetricsEnabled()) {
|
if (config.isMetricsEnabled()) {
|
||||||
statistisc = new Statistics(this);
|
statistisc = new Statistics(this);
|
||||||
}
|
}
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_IO_ERROR).error(e).callerParam(statistisc));
|
reporter.reportDetailed(this, Report.newBuilder(REPORT_METRICS_IO_ERROR).error(e).callerParam(statistisc));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -537,6 +553,10 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}, ASYNC_MANAGER_DELAY, ASYNC_MANAGER_DELAY);
|
}, ASYNC_MANAGER_DELAY, ASYNC_MANAGER_DELAY);
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (packetTask == -1) {
|
if (packetTask == -1) {
|
||||||
reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_CREATE_TIMEOUT_TASK).error(e));
|
reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_CREATE_TIMEOUT_TASK).error(e));
|
||||||
@ -625,10 +645,16 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
// Get the Bukkit logger first, before we try to create our own
|
// Get the Bukkit logger first, before we try to create our own
|
||||||
private Logger getLoggerSafely() {
|
private Logger getLoggerSafely() {
|
||||||
Logger log = null;
|
Logger log = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log = getLogger();
|
log = getLogger();
|
||||||
} catch (Throwable e) { }
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
|
||||||
// Use the default logger instead
|
// Use the default logger instead
|
||||||
if (log == null)
|
if (log == null)
|
||||||
|
@ -604,6 +604,10 @@ public class AsyncListenerHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Minecraft doesn't want your Exception.
|
// Minecraft doesn't want your Exception.
|
||||||
filterManager.getErrorReporter().reportMinimal(listener.getPlugin(), methodName, e);
|
filterManager.getErrorReporter().reportMinimal(listener.getPlugin(), methodName, e);
|
||||||
|
@ -125,7 +125,7 @@ public class DetailedErrorReporter implements ErrorReporter {
|
|||||||
private static Logger getBukkitLogger() {
|
private static Logger getBukkitLogger() {
|
||||||
try {
|
try {
|
||||||
return Bukkit.getLogger();
|
return Bukkit.getLogger();
|
||||||
} catch (Throwable e) {
|
} catch (LinkageError e) {
|
||||||
return Logger.getLogger("Minecraft");
|
return Logger.getLogger("Minecraft");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ public class DetailedErrorReporter implements ErrorReporter {
|
|||||||
try {
|
try {
|
||||||
if (!apacheCommonsMissing)
|
if (!apacheCommonsMissing)
|
||||||
return (ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null));
|
return (ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null));
|
||||||
} catch (Throwable ex) {
|
} catch (LinkageError ex) {
|
||||||
// Apache is probably missing
|
// Apache is probably missing
|
||||||
apacheCommonsMissing = true;
|
apacheCommonsMissing = true;
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,10 @@ public class PacketConstructor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
result = unwrapper.unwrapItem(values[i]);
|
result = unwrapper.unwrapItem(values[i]);
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
lastException = e;
|
lastException = e;
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,10 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
|||||||
// The plugin verifier - we don't want to stop ProtocolLib just because its failing
|
// The plugin verifier - we don't want to stop ProtocolLib just because its failing
|
||||||
try {
|
try {
|
||||||
this.pluginVerifier = new PluginVerifier(builder.getLibrary());
|
this.pluginVerifier = new PluginVerifier(builder.getLibrary());
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportWarning(this, Report.newBuilder(REPORT_PLUGIN_VERIFIER_ERROR).
|
reporter.reportWarning(this, Report.newBuilder(REPORT_PLUGIN_VERIFIER_ERROR).
|
||||||
messageParam(e.getMessage()).error(e));
|
messageParam(e.getMessage()).error(e));
|
||||||
|
@ -156,6 +156,11 @@ class ReadPacketModifier implements MethodInterceptor {
|
|||||||
override.put(thisObj, result);
|
override.put(thisObj, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Minecraft cannot handle this error
|
// Minecraft cannot handle this error
|
||||||
reporter.reportDetailed(this,
|
reporter.reportDetailed(this,
|
||||||
|
@ -120,6 +120,10 @@ public class WritePacketModifier implements MethodInterceptor {
|
|||||||
output.write(outputBuffer);
|
output.write(outputBuffer);
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Minecraft cannot handle this error
|
// Minecraft cannot handle this error
|
||||||
reporter.reportDetailed(this,
|
reporter.reportDetailed(this,
|
||||||
|
@ -359,6 +359,10 @@ public class InjectedServerConnection {
|
|||||||
// If so, copy the content of the old element to the new
|
// If so, copy the content of the old element to the new
|
||||||
try {
|
try {
|
||||||
writer.copyTo(inserting, replacement, inserting.getClass());
|
writer.copyTo(inserting, replacement, inserting.getClass());
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportDetailed(InjectedServerConnection.this,
|
reporter.reportDetailed(InjectedServerConnection.this,
|
||||||
Report.newBuilder(REPORT_CANNOT_COPY_OLD_TO_NEW).messageParam(inserting).callerParam(inserting, replacement).error(e)
|
Report.newBuilder(REPORT_CANNOT_COPY_OLD_TO_NEW).messageParam(inserting).callerParam(inserting, replacement).error(e)
|
||||||
|
@ -86,6 +86,10 @@ class NetLoginInjector {
|
|||||||
// NetServerInjector can never work (currently), so we don't need to replace the NetLoginHandler
|
// NetServerInjector can never work (currently), so we don't need to replace the NetLoginHandler
|
||||||
return inserting;
|
return inserting;
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Minecraft can't handle this, so we'll deal with it here
|
// Minecraft can't handle this, so we'll deal with it here
|
||||||
reporter.reportDetailed(this,
|
reporter.reportDetailed(this,
|
||||||
@ -129,6 +133,10 @@ class NetLoginInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Don't leak this to Minecraft
|
// Don't leak this to Minecraft
|
||||||
reporter.reportDetailed(this,
|
reporter.reportDetailed(this,
|
||||||
|
@ -221,6 +221,10 @@ class NetworkServerInjector extends PlayerInjector {
|
|||||||
if (proxyServerField != null && !proxyServerField.equals(serverHandlerRef.getField())) {
|
if (proxyServerField != null && !proxyServerField.equals(serverHandlerRef.getField())) {
|
||||||
try {
|
try {
|
||||||
return FieldUtils.readField(proxyServerField, serverHandler, true);
|
return FieldUtils.readField(proxyServerField, serverHandler, true);
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Oh well
|
// Oh well
|
||||||
}
|
}
|
||||||
|
@ -642,6 +642,10 @@ public abstract class PlayerInjector implements SocketInjector {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_HANDLE_PACKET).error(e).callerParam(packet));
|
reporter.reportDetailed(this, Report.newBuilder(REPORT_CANNOT_HANDLE_PACKET).error(e).callerParam(packet));
|
||||||
}
|
}
|
||||||
|
@ -221,6 +221,12 @@ public class BackgroundCompiler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
setEnabled(false);
|
||||||
|
throw e;
|
||||||
|
} catch (ThreadDeath e) {
|
||||||
|
setEnabled(false);
|
||||||
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Disable future compilations!
|
// Disable future compilations!
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren