环境信息
arthas-boot.jar
或者 as.sh
的版本:3.6.7
- Arthas 版本: 3.6.7
- 操作系统版本: centos
- 目标进程的JVM版本: jdk 17
- 执行
arthas-boot
的版本: 3.6.7
重现问题的步骤
- 在容器中,通过启动arthas,选择对应的进程进行分析
# java -jar arthas-boot.jar
[INFO] JAVA_HOME: /usr/local/xxxopenjdk/jdk-17
[INFO] arthas-boot version: 3.6.7
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
- [1]: 1 /opt/xxx-agent/xxx-agent.jar
[2]: 6 io.trino.server.TrinoServer
2
- 使用结束后,通过
stop
退出arthas,lsof -i:3658
发现3658端口不再被监听
- 再次尝试使用arthas分析进程,出现
Connection refused
报错
[INFO] arthas home: /opt/xxx/arthas/arthas
[INFO] Try to attach process 6
Picked up JAVA_TOOL_OPTIONS:
/opt/xxx/arthas/arthas# java -jar arthas-boot.jar 6
[INFO] JAVA_HOME: /usr/local/xxxopenjdk/jdk-17
[INFO] arthas-boot version: 3.6.7
[INFO] arthas home: /opt/xxx/arthas/arthas
[INFO] Try to attach process 6
Picked up JAVA_TOOL_OPTIONS:
[ERROR] Start arthas failed, exception stack trace:
com.sun.tools.attach.AgentLoadException: Agent JAR not found or no Agent-Class attribute
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:160)
at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:122)
at com.taobao.arthas.core.Arthas.(Arthas.java:27)
at com.taobao.arthas.core.Arthas.main(Arthas.java:161)
[INFO] Attach process 6 success.
[INFO] arthas-client connect 127.0.0.1 3658
Connect to telnet server error: 127.0.0.1 3658
java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method)
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:542)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:633)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:188)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:209)
at com.taobao.arthas.client.TelnetConsole.process(TelnetConsole.java:306)
at com.taobao.arthas.client.TelnetConsole.main(TelnetConsole.java:166)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.taobao.arthas.boot.Bootstrap.main(Bootstrap.java:629)
Usage: arthas-client [--help] [-c ] [-f ] [-w ] [-t
] [-h ] [target-ip] [port]
Arthas Telnet Client
EXAMPLES:
java -jar arthas-client.jar 127.0.0.1 3658
java -jar arthas-client.jar -c 'dashboard -n 1'
java -jar arthas-client.jar -f batch.as 127.0.0.1
Options and Arguments:
--help Print usage
-c,--command Command to execute, multiple commands
separated by ;
-f,--batch-file The batch file to execute
-w,--width The terminal width
-t,--execution-timeout The timeout (ms) of execute commands or batch
file
-h,--height The terminal height
Target ip
The remote server port
```
- **一旦出现该错误,再也无法通过arthas绑定进程**