JDK-8205992 : jhsdb cannot attach to Java processes running in Docker containers
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 9,10,11,12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-06-28
  • Updated: 2024-06-04
  • Resolved: 2018-07-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11.0.11Fixed 12 b05Fixed
Related Reports
Relates :  
Description
jcmd supports container in JDK-8193710. However. jhsdb cannot do it.

JDK-8193710 has been changed to check PID namespace. jhsdb should also do so.
Comments
Fix request for 11u: This patch makes jhsdb to attach to the process on container. Original change cannot apply cleanly due to JDK-8202884. The conflict is caused by header file inclusion in ps_proc.c, the others can be applied cleanly. Review thread: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-December/004445.html
18-12-2020

URL: http://hg.openjdk.java.net/jdk/jdk/rev/220c9188db4f User: ysuenaga Date: 2018-07-26 15:54:56 +0000
26-07-2018

http://mail.openjdk.java.net/pipermail/serviceability-dev/2018-June/024288.html I tried to attach jhsdb to java process in docker container from container host, but it couldn't. jcmd supports PID namespace in JDK-8193710, but jhsdb hasn't yet. SA gets LWP ID via thread stack and funcs in libthread_db.so, but they returns PIDs in container - they are different from host's PID. So I added the code to scan /proc/<PID>/task to get all LWP IDs and they are kept in a Map in LinuxDebuggerLocal. Also SA_ALTROOT is set to /proc/<PID>/root if SA detects debuggee runs in container. It helps SA to parse binaries in container.
10-07-2018