运行Minecraft服务器时JRE出现SIGSEGV错误的排查与解决
问题描述
在Oracle Linux Server 8.10(29G内存)上运行Paper版Minecraft服务器(1.21.3)时,出现两种SIGSEGV崩溃情况:
- 世界生成完成后立即触发SIGSEGV错误并生成core dump
- 服务器正常运行,直到玩家加入后触发SIGSEGV错误并生成core dump
启动步骤:
- 通过
wget下载Paper版本(已尝试1.21.3不稳定版、1.21.1稳定版) - 执行启动命令:
java -Xms4G -Xmx4G -jar server.jar nogui(已测试3G到20G的不同-Xms参数)
完整错误日志:
[22:29:49 INFO]: Done (48.297s)! For help, type "help" [22:29:49 INFO]: Timings Reset [22:33:07 INFO]: UUID of player bowosc is 2fdf21ec-0388-4f50-adf6-73b3c4d7m0f2 [22:33:08 INFO]: bowosc joined the game [22:33:08 INFO]: bowosc[/MYIP] logged in with entity id 33 at ([world]3.5, 69.0, 5.5) # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f162b4b3ecf, pid=17317, tid=17359 # # JRE version: Java(TM) SE Runtime Environment (23.0.1+11) (build 23.0.1+11-39) # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0.1+11-39, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # C [spark-cf69683bbb7-libasyncProfiler.so.tmp+0x6ecf] NMethod::isNMethod()+0x1f # # Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e" (or dumping to /home/opc/core.17317) # # An error report file with more information is saved as: # /home/opc/hs_err_pid17317.log [254.152s][warning][os] Loading hsdis library failed # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # Aborted (core dumped)
错误原因分析
从错误日志的Problematic frame字段可以明确,崩溃触发点在spark-cf69683bbb7-libasyncProfiler.so.tmp——这是Minecraft性能分析插件Spark的内置异步分析器库。具体是NMethod::isNMethod()方法引发段错误,核心原因是:
- 当前使用的JDK 23.0.1属于较新版本,Spark内置的asyncProfiler库对其支持不完善,存在兼容性冲突
- 该库与Oracle Linux 8.10的系统环境适配性不足
注:调整Java堆内存参数无法解决此问题,因为错误发生在本地Native库层面,与JVM堆内存配置无关。
解决方法
方法1:移除/禁用Spark插件
如果服务器不需要性能分析功能,直接删除服务器plugins目录下的Spark插件文件,重启服务器即可。
方法2:降级Java版本到LTS版
Minecraft 1.21.x官方推荐使用JDK 17(长期支持版),兼容性更稳定:
- 卸载当前JDK 23:
(若通过yum安装则执行sudo rpm -e jdk-23.0.1sudo yum remove java-23-openjdk) - 安装JDK 17:
sudo yum install java-17-openjdk-devel - 切换默认Java版本:
在弹出的选项中选择JDK 17对应的条目sudo alternatives --config java - 重新启动Minecraft服务器
方法3:更新Spark插件到最新兼容版本
下载针对JDK 23和Paper 1.21.x的最新版Spark插件,替换原插件文件后重启服务器。
内容的提问来源于stack exchange,提问作者bodoed
相关产品推荐
相关产品推荐

