[alibaba/arthas]Web 远程访问 Arthas 无法打开界面

2024-07-17 479 views
6
环境信息
  • arthas-boot.jar 或者 as.sh 的版本: 3.6.9
  • Arthas 版本: 3.6.9
  • 操作系统版本: alpine3.18
  • 目标进程的JVM版本: openjdk 1.8
  • 执行arthas-boot的版本: 3.6.9
重现问题的步骤
  1. 进入目标容器
  2. 执行命令./as.sh --agent-id $HOSTNAME --tunnel-server 'ws://Server IP Address:7777/ws'
期望的结果

正常连接可以远程调试arthas

实际运行的结果

实际运行结果,最好有详细的日志,异常栈。尽量贴文本。

2023-06-27 17:07:52.229  INFO 1 --- [Server-boss-1-1] io.netty.handler.logging.LoggingHandler  : [id: 0xcedc393f, L:/0.0.0.0:7777] READ: [id: 0x1c451c48, L:/172.17.0.2:7777 - R:/192.168.31.193:57788]
2023-06-27 17:07:52.229  INFO 1 --- [Server-boss-1-1] io.netty.handler.logging.LoggingHandler  : [id: 0xcedc393f, L:/0.0.0.0:7777] READ COMPLETE
2023-06-27 17:07:52.233  INFO 1 --- [rver-worker-3-4] c.a.a.t.server.TunnelSocketFrameHandler  : websocket handshake complete, uri: /ws?method=connectArthas&id=gray-ctms-backend-admin-676dd6579c-jf7v7
2023-06-27 17:07:52.234  INFO 1 --- [rver-worker-3-4] c.a.a.t.server.TunnelSocketFrameHandler  : try to connect to arthas agent, id: gray-ctms-backend-admin-676dd6579c-jf7v7
2023-06-27 17:07:52.234  WARN 1 --- [rver-worker-3-4] io.netty.channel.DefaultChannelPipeline  : An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.

java.lang.IllegalArgumentException: WebSocket close status code does NOT comply with RFC-6455: 2000
    at io.netty.handler.codec.http.websocketx.CloseWebSocketFrame.requireValidStatusCode(CloseWebSocketFrame.java:202) ~[netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.CloseWebSocketFrame.<init>(CloseWebSocketFrame.java:69) ~[netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at com.alibaba.arthas.tunnel.server.TunnelSocketFrameHandler.connectArthas(TunnelSocketFrameHandler.java:219) ~[classes!/:3.6.9]
    at com.alibaba.arthas.tunnel.server.TunnelSocketFrameHandler.userEventTriggered(TunnelSocketFrameHandler.java:71) ~[classes!/:3.6.9]
    at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:400) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:376) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:368) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandshakeHandler$1.operationComplete(WebSocketServerProtocolHandshakeHandler.java:104) [netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandshakeHandler$1.operationComplete(WebSocketServerProtocolHandshakeHandler.java:93) [netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:185) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:95) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:30) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandshakeHandler.channelRead(WebSocketServerProtocolHandshakeHandler.java:93) [netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.onHttpRequestChannelRead(WebSocketServerExtensionHandler.java:160) [netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:86) [netty-codec-http-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [netty-codec-4.1.91.Final.jar!/:4.1.91.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) [netty-codec-4.1.91.Final.jar!/:4.1.91.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) [netty-codec-4.1.91.Final.jar!/:4.1.91.Final]
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [netty-transport-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.92.Final.jar!/:4.1.92.Final]
    at java.lang.Thread.run(Thread.java:750) [na:1.8.0_372]

回答

4

在 issue 里搜下,比较大可能是多个 client 共用了一个 agentId 。

4

同样的问题 arthas-tunnel-server-3.7.1 arthas-spring-boot-starter : 3.5.5