apache / servicecomb-java-chassis

ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features
Apache License 2.0
1.91k stars 813 forks source link

项目启动后过一段时间cpu升高 #4302

Open qwerty759 opened 6 months ago

qwerty759 commented 6 months ago

{"instant":{"epochSecond":1713397746,"nanoOfSecond":767000000},"thread":"vert.x-eventloop-thread-22","level":"ERROR","loggerName":"io.vertx.core.impl.ContextImpl","message":"Unhandled exception","thrown":{"commonElementCount":0,"name":"java.lang.NullPointerException","extendedStackTrace":"java.lang.NullPointerException: null\n\tat io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.setFinalBuffer(HttpPostStandardRequestDecoder.java:639) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBodyAttributes(HttpPostStandardRequestDecoder.java:593) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBody(HttpPostStandardRequestDecoder.java:378) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.offer(HttpPostStandardRequestDecoder.java:310) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.offer(HttpPostStandardRequestDecoder.java:49) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.offer(HttpPostRequestDecoder.java:223) ~[netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.vertx.core.http.impl.HttpServerRequestImpl.onData(HttpServerRequestImpl.java:490) ~[vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.http.impl.HttpServerRequestImpl.handleContent(HttpServerRequestImpl.java:138) ~[vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.http.impl.Http1xServerConnection.handleContent(Http1xServerConnection.java:160) ~[vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:140) ~[vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) [vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) [vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229) [vertx-core-3.9.11.jar:3.9.11]\n\tat io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:164) [vertx-core-3.9.11.jar:3.9.11]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:102) [netty-codec-http-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [netty-handler-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [netty-codec-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) [netty-codec-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [netty-transport-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [netty-common-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.55.Final.jar:4.1.55.Final]\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.55.Final.jar:4.1.55.Final]\n\tat java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]\n"},"endOfBatch":false,"loggerFqcn":"io.vertx.core.logging.Logger","skyWalkingDynamicField":{"traceId":"N/A"},"threadId":148,"threadPriority":5,"source":{"class":"io.vertx.core.impl.ContextImpl","method":"reportException","file":"ContextImpl.java","line":413},"traceId":"N/A","host":"hzg-sjcj1","@timestamp":"2024-04-18T07:49:06.767+08:00"}

可以帮忙看下这个问题吗,项目用的版本是 1.3.11 ,项目重启之后过一段时间就会报这种错 然后一直打印 下面这个这个异常,服务器的cpu也变高了。

{"instant":{"epochSecond":1713397900,"nanoOfSecond":544000000},"thread":"vertx-blocked-thread-checker","level":"WARN","loggerName":"io.vertx.core.impl.BlockedThreadChecker","message":"Thread Thread[vert.x-eventloop-thread-22,5,main]=Thread[vert.x-eventloop-thread-22,5,main] has been blocked for 2677 ms, time limit is 2000 ms","endOfBatch":false,"loggerFqcn":"io.vertx.core.logging.Logger","skyWalkingDynamicField":{"traceId":"N/A"},"threadId":117,"threadPriority":5,"source":{"class":"io.vertx.core.impl.BlockedThreadChecker$1","method":"run","file":"BlockedThreadChecker.java","line":59},"traceId":"N/A","host":"hzg-sjcj1","@timestamp":"2024-04-18T07:51:40.544+08:00"}

liubao68 commented 6 months ago

不知道是不是netty/vertx等版本不兼容,可以参考 https://github.com/apache/servicecomb-java-chassis/blob/1.3.11/java-chassis-dependencies/default/pom.xml 调整下netty/vertx版本试试。

qwerty759 commented 6 months ago

用的maven坐标是这个

      <groupId>org.apache.servicecomb</groupId>
      <artifactId>java-chassis-dependencies</artifactId>
      <version>1.3.11</version>

netty/vertx版本都是通过这个依赖间接引入的。版本分别是 netty:4.1.55.Final ; vertx:3.9.11