PluginCatcher

8.1k Downloads

Note: This plugin is not a magic solution to problems.

PluginCatcher

PluginCatcher is a development tool for detecting potential plugin-based causes of server crashes. It is a complex plugin which will cause a slight performance hit on your server while it is active, in order to detect risky behavior by plugins. Currently it primarily detects situations that can lead to ConcurrentModificationException. It is important to note that this plugin cannot detect all scenarios leading to such crashes, but can certainly catch a large number.

Server Owners

Unless you know exactly what this does and why you're here, turn around now. Or contact mbaxter with your crash reports and he'll tell you if this will work.

Developers

Hey, you! Want to detect potential causes of CMEs in your plugins? Awesome! Let's get to work

What can cause CMEs?

The Minecraft server handles nearly all functionality on one thread, what we'll call the main thread. As such, most of its methods (and through that, most Bukkit API) are not designed to handle calls from other threads. Asynchronous calls made while the server is iterating or otherwise interacting with internal Collections which are not thread-safe have the potential to cause a CME. A big place where this comes up is plugin developers calling Bukkit API methods from the AsyncPlayerChatEvent.

Commands

There aren't any! Hah!

Permissions

None! Gotcha!

Configuration

There is one important config value, called onlydangerous. By default true, this setting determines what types of issues are reported. The default setting will only report potential server-killing CME causers. If you set it to false, it will do that plus detect other potentially bad async calls that could cause other issues on your own async thread.

The other config value is meow. If true, cat!

Data Output Location

The plugin outputs all of this info to its plugin folder in a file named async.log. It will log one line to console when it detects issues and logs them. If it stays empty, there hasn't been a potential problem yet. Nice work!

What does it output?

PluginCatcher attempts to figure out what plugin made the risky call by checking the stacktrace lines against plugins' loaded classes. If it finds a match (or matches) it records that plugin and version to the log. Otherwise it reports it as unknown source. Plugin guessing is presented purely for convenience. Never assume a listed plugin is the definite source.

Next, it prints the stacktrace, so you can see what plugin made the call, where it was made, etc. This is where you fix your code to not make that call async.