RFR: 8284330: jcmd may not be able to find processes in the container [v2]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Wed Apr 6 12:44:35 UTC 2022
> jcmd uses src/jdk.internal.jvmstat/linux/classes/sun/jvmstat/PlatformSupportImpl.java to scan temporary directories to find out processes in the container. It checks inode to ensure the temp directory is not conflicted. However inode maybe same value between the container and others. Thus we should check device id for that case.
>
> For example I saw following case on [distroless cc-debian11](https://github.com/GoogleContainerTools/distroless/blob/main/cc/README.md) container. I started rescue:jdk19 container with sharing PID namespace. `/proc/1/root/tmp` is different from `/tmp` on rescue:jdk19, but they are same inode value. However we can see the differense in device id.
>
>
> $ podman run -it --rm --entrypoint=sh --pid=container:fa39662f7352 rescue:jdk19
> / #
> / # stat /tmp
> File: /tmp
> Size: 29 Blocks: 0 IO Block: 4096 directory
> Device: efh/239d Inode: 135674931 Links: 1
> Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
> Access: 2022-04-05 08:51:37.000000000
> Modify: 2022-04-05 08:51:37.000000000
> Change: 2022-04-05 08:51:37.000000000
>
> / # stat /proc/1/root/tmp
> File: /proc/1/root/tmp
> Size: 29 Blocks: 0 IO Block: 4096 directory
> Device: e1h/225d Inode: 135674931 Links: 1
> Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
> Access: 2022-04-05 08:51:37.000000000
> Modify: 2022-04-05 08:50:42.000000000
> Change: 2022-04-05 08:50:42.000000000
Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
Fix comments
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/8103/files
- new: https://git.openjdk.java.net/jdk/pull/8103/files/e5f76a60..0e0ccbe0
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8103&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8103&range=00-01
Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod
Patch: https://git.openjdk.java.net/jdk/pull/8103.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8103/head:pull/8103
PR: https://git.openjdk.java.net/jdk/pull/8103
More information about the serviceability-dev
mailing list