-
Notifications
You must be signed in to change notification settings - Fork 476
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
jmap not happy on alpine #76
Comments
Other tools that don't work: |
Not working in openjdk 7 neither. |
This seems related: gliderlabs/docker-alpine#11. |
Tried what @yosifkit linked. Installed
Docker image: |
Indeed -- I don't think there's much we can do about this. 😞 |
I noticed that too. This happens because your java process PID is 1. |
If you keep bash as PID 1, you'd no longer get signals from |
@yosifkit you are absolutely right. |
This may be a result of the debug symbols not being installed in the image. See comment 9 on this issue or comment 15 on this issue. |
For those arriving late to the party, like me, this issue appears to be unrelated to the underlying libc implementation. |
I have to use docker 1.12 and don't know if '--init' will be used in Kubernetes, so I solved this issue by wrapping java process in shell script and adding trap for TERM signal. At least jmap now works for me. |
Closing, since this appears to be solved by either using Docker's |
So how can I use jmap ? |
You can change docker file and instead of running java as |
I disagree that this is unrelated to the libc version in alpine. A simple docker test with FROM openjdk:8 runs the java process as PID 1, and jcmd (and similar tools) still work. GIven this dockerfile building and running (assuming the Hello program is long-running), then I can do this: Change the dockerfile to have FROM openjdk:8-alpine and only then do I have the issue of not being able to attach to PID 1. I'm not saying this is definitely because of the use of musl instead of glibc; it could be some way that alpine linux sets up the /proc system that is different than other linux containers. But the issue does seem to lie with Alpine. |
Ping! Still facing this issue, can we please reopen this and triage the underlying issue? |
hi you need to add openjdk8.xx.alpine . we are getting the same problem. |
No, OpenJDK 8 on Alpine are no longer maintained here since Alpine/musl in not officially supported by the OpenJDK project. See also #372 (comment). |
After ~ 3 days of running, the success-modeling container runs out of memory (2Gb provided). [pool-10-thread-1] ERROR org.web3j.protocol.core.filters.Filter - Error sending request java.lang.OutOfMemoryError: Java heap space Possibly related, was nearby in the logs: WARNING: A connection to http://las2peer-ethnet:8545/ was leaked. Did you forget to close a response body? To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE); see the following for details: - docker-library/openjdk#76 - http://www.programmersought.com/article/454192941/ - https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/ without running some sort of init process, we cannot create a heapdump of java to see where the memory leak occurs.
As a google breadcrumb; https://github.com/apangin/jattach is able to generate heap dumps from within an Alpine / OpenJDK8 based container. |
This solves the issue related to docker-library/openjdk#76 In a container based on java alpine, commands like `jmap`, `jstack` don't work, and the pid of alluxio processes like `AlluxioWorker` is 1. Before: ``` bash-4.4$ jps 1 AlluxioMaster 904 Jps bash-4.4$ jstack 1 1: Unable to get pid of LinuxThreads manager thread ``` After: ``` bash-4.4# jps 357 Jps 6 AlluxioWorker # And jstack will work ``` pr-link: #12233 change-id: cid-e60f913ec30d1718142d1311eb97e4f44b568973
This solves the issue related to docker-library/openjdk#76 In a container based on java alpine, commands like `jmap`, `jstack` don't work, and the pid of alluxio processes like `AlluxioWorker` is 1. Before: ``` bash-4.4$ jps 1 AlluxioMaster 904 Jps bash-4.4$ jstack 1 1: Unable to get pid of LinuxThreads manager thread ``` After: ``` bash-4.4# jps 357 Jps 6 AlluxioWorker # And jstack will work ``` pr-link: #12233 change-id: cid-e60f913ec30d1718142d1311eb97e4f44b568973
I too faced this issue with openjdk:8-jdk-alpine when PID was 1. Then I changed base image to maven:3.8.2-jdk-8 . Then It worked fine even with PID 1. So its likely not a PID being 1 issue. note: The image which solved the issue is a jdk8 based image by maven, not an openjdk based image. For openjdk you may have to install the openjdk-devel or openjdk-dbg kinda stuff because openjdk apparently does not come with debug facilities like jmap stack etc |
This issue is fixed by patch icedtea-issue13032.patch and on amazoncorretto:8-alpine as well. |
TL; DR:
The detail analysis is on the post(Chinese). |
run cmd add
|
Dockerfile中如何编写? |
正常写就行了 COPY ../target/management.jar /opt/project/management.jar WORKDIR /opt/project CMD java -jar management.jar |
Dockerfile中如何使用 --init 参数 还是 只能docker run的时候使用 目前可以使用 tini 插件解决 就是感觉 不想安装
|
直接在docker run时候添加参数就行,不需要安装其他插件 |
现在是在K8S运行 那样可能需要运维修改了 |
We ran into an issue today where we needed to take a heap dump (jmap). But it wasn't working.
Image was
java:openjdk-8u92-jdk-alpine
.Here's the source of the error: http://code.metager.de/source/xref/openjdk/jdk8/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c#255
We suspect it might be because alpine is using musl instead of glibc.
jmap works in
java:openjdk-8u91-jdk
.The text was updated successfully, but these errors were encountered: