注意:此插件并非解决所有问题的万能方案。
PluginCatcher
PluginCatcher 是一款用于检测可能导致服务器崩溃的潜在模组相关问题的开发工具。它是一款功能复杂的插件,在运行时会对服务器性能造成轻微影响,以便侦测模组中的高风险行为。目前,它主要能够检测可能引发 ConcurrentModificationException(并发修改异常)的情况。需要注意的是,此插件无法检测导致此类崩溃的所有场景,但确实可以捕获大量问题。
服务器管理员
除非你清楚此插件的作用以及为何需要它,否则请立即离开。或者,你可以将崩溃报告发送给 mbaxter,他会告知你是否适用。
开发者
嘿,就是你!想要检测你的插件中可能导致 CME(并发修改异常)的潜在原因吗?太棒了!让我们开始吧
什么会导致 CME?
Minecraft 服务器在单个线程上处理几乎所有功能,我们称之为“主线程”。因此,其大多数方法(以及由此衍生的大部分 Bukkit API)并非设计用于处理来自其他线程的调用。当服务器正在迭代或以其他方式与内部非线程安全的集合进行交互时,发起异步调用有可能引发并发修改异常(CME)。这种情况的一个常见场景是插件开发者从 AsyncPlayerChatEvent 中调用 Bukkit API 方法。
命令
没有任何命令!哈哈!
权限
没有权限!骗到了吧!
配置
有一个重要的配置值,名为 onlydangerous。默认值为 true,该设置决定报告哪些类型的问题。默认设置仅会报告可能导致服务器崩溃的 CME 诱因。如果将其设置为 false,它将执行此操作,同时检测其他可能导致你自己的异步线程出现问题的潜在不良异步调用。
另一个配置值是 meow。如果为 true,则喵!
数据输出位置
插件将所有这些信息输出到其插件文件夹中的 async.log 文件中。当它检测到问题并记录日志时,会在控制台输出一行信息。如果文件保持为空,说明目前尚未出现问题。干得好!
它会输出什么?
PluginCatcher 尝试通过检查堆栈跟踪行与插件已加载类的匹配情况,来确定是哪个插件进行了危险调用。如果找到匹配项(或多个匹配项),它会将该插件及其版本记录到日志中;否则,它会将其报告为未知来源。插件猜测功能纯粹是为了方便使用,切勿假设列出的插件就是确定的来源。
接下来,它会打印出堆栈跟踪信息,以便你查看是哪个插件发起了调用、调用发生的位置等。此时你需要修改代码,避免进行异步调用。
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.
评论 0
登录后参与评分
还没有评论,来抢沙发吧