背景说明
最近接触新工程(spring boot 微服务),目前线上均正常运行,但在本地跑的时候,发现无法启动运行。错误信息如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000107ed2afe, pid=52204, tid=0x0000000000008a13
#
# JRE version: OpenJDK Runtime Environment (8.0_372) (build 1.8.0_372-bre_2023_04_25_03_23-b00)
# Java VM: OpenJDK 64-Bit Server VM (25.372-b00 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V [libjvm.dylib+0x540afe]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /xxx/hs_err_pid52204.log
#
Stack: [0x000070000ce10000,0x000070000cf10000], sp=0x000070000cf0de30, free space=1015k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x540afe]
j sun.misc.Unsafe.putByte(Ljava/lang/Object;JB)V+0
j io.netty.util.internal.PlatformDependent0.putByte(Ljava/lang/Object;JB)V+6
j io.netty.util.internal.PlatformDependent.putByte(Ljava/lang/Object;JB)V+3
j io.netty.buffer.ByteBufUtil.unsafeWriteUtf8([BJILjava/lang/CharSequence;II)I+73
j io.netty.buffer.ByteBufUtil.writeUtf8(Lio/netty/buffer/AbstractByteBuf;IILjava/lang/CharSequence;II)I+79
j io.netty.buffer.ByteBufUtil.reserveAndWriteUtf8Seq(Lio/netty/buffer/ByteBuf;Ljava/lang/CharSequence;III)I+47
j io.netty.buffer.ByteBufUtil.writeUtf8(Lio/netty/buffer/ByteBuf;Ljava/lang/CharSequence;)I+15
j org.redisson.client.handler.CommandEncoder.encode(Ljava/lang/Object;)Lio/netty/buffer/ByteBuf;+66
j org.redisson.client.handler.CommandEncoder.encode(Lio/netty/channel/ChannelHandlerContext;Lorg/redisson/client/protocol/CommandData;Lio/netty/buffer/ByteBuf;)V+125
j org.redisson.client.handler.CommandEncoder.encode(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/buffer/ByteBuf;)V+7
j io.netty.handler.codec.MessageToByteEncoder.write(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V+33
j org.redisson.client.handler.CommandEncoder.write(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V+22
j io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V+10
j io.netty.channel.AbstractChannelHandlerContext.invokeWrite(Ljava/lang/Object;Lio/netty/channel/ChannelPromise;)V+10
j io.netty.channel.AbstractChannelHandlerContext.write(Ljava/lang/Object;ZLio/netty/channel/ChannelPromise;)V+101
网上资料
- Springboot Redisson Xxljob(Druid MySQL MybatisPlus) 对接使用
https://blog.csdn.net/c_zyer/article/details/123788093 - https://github.com/netty/netty/issues/12119
原因分析
目前综合网上资料,应该是netty与openjdk的兼容问题,当前netty此issue属于open状态。
解决办法
- 更换netty 版本
<dependency> <groupId>io.netty</groupId> <artifactId>netty-bom</artifactId> <version>4.1.36.Final</version> <type>pom</type> <scope>import</scope> </dependency>
- 更换open jdk
我这边更换了 Temurin OpenJDK 8 1.8.0_372