-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attach docker 里 pid 1的进程报错 #362
Comments
具体用的是什么 docker 镜像,详细的 url 。是否java进程都跑在docker里的。 |
这个貌似是docker的问题: docker-library/openjdk#76 有两种解法:
|
参考这个docker 镜像,测试没有问题: https://cloud.docker.com/repository/docker/hengyunabc/arthas |
增加 docker文档: https://alibaba.github.io/arthas/docker.html |
* use jdk as base image * start script as standalone sh file, to avoid alibaba/arthas#362
java -jar arthas-boot.jar 1 |
这个问题的主要原因是没法通过信号启动jvm的Attach Listener,解决方案很简单: pid=1 ;\
touch /proc/${pid}/cwd/.attach_pid${pid} && \
kill -SIGQUIT ${pid} && \
sleep 2 &&
ls /proc/${pid}/root/tmp/.java_pid${pid}
# 接下来就可以正常 java -jar arthas-boot.jar 挂arthas了 具体的分析见https://robberphex.com/attach-jvm-in-container-at-arthas/。 |
@hengyunabc @robberphex 下面是log: /opt/hawkbit # java -jar arthas-boot.jar
Arthas Telnet Client EXAMPLES: Options and Arguments: |
环境信息
是在docker容器里执行的 java -jar arthas-boot.jar
今天刚下的git最新版本
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (IcedTea 3.6.0) (Alpine 8.151.12-r0)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
重现问题的步骤
/home # java -jar arthas-boot.jar
[INFO] arthas home: /root/.arthas/lib/3.0.5/arthas
[INFO] Try to attach process 1
/home # ps xf
PID USER TIME COMMAND
1 root 489:16 java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
16416 root 0:00 ./bin/sh
17936 root 0:00 ps xf
期望的结果
服务启动正常
实际运行的结果
[ERROR] Start arthas failed, exception stack trace:
com.sun.tools.attach.AttachNotSupportedException: Unable to get pid of LinuxThreads manager thread
at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:86)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:250)
at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:72)
at com.taobao.arthas.core.Arthas.(Arthas.java:25)
at com.taobao.arthas.core.Arthas.main(Arthas.java:99)
[ERROR] attach fail, targetPid: 1
[ERROR] Start arthas failed, exception stack trace:
com.sun.tools.attach.AttachNotSupportedException: Unable to get pid of LinuxThreads manager thread
at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:86)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:250)
at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:72)
at com.taobao.arthas.core.Arthas.(Arthas.java:25)
at com.taobao.arthas.core.Arthas.main(Arthas.java:99)
[ERROR] attach fail, targetPid: 1
The text was updated successfully, but these errors were encountered: