JDK-8341310 : Test TestJcmdWithSideCar.java should skip ACCESS_TMP_VIA_PROC_ROOT (after JDK-8327114)
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-10-01
  • Updated: 2024-10-14
  • Resolved: 2024-10-03
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 24
24 b19Fixed
Related Reports
Relates :  
Relates :  
Description
After integration of JDK-8327114 the following failure in containers/docker/TestJcmdWithSideCar.java has been observed:

----------System.err:(11/638)----------
java.lang.RuntimeException: ACCESS_TMP_VIA_PROC_ROOT: Could not find specified process
	at TestJcmdWithSideCar.testCase01(TestJcmdWithSideCar.java:138)
	at TestJcmdWithSideCar.main(TestJcmdWithSideCar.java:111)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:573)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1576)


Comments
Logged JDK-8341518 to follow up the separate intermittent failure we are seeing: java.lang.RuntimeException: 'sun.tools.jcmd.JCmd' missing from stdout/stderr
04-10-2024

This fix is integrated in jdk-24+18-2079.
03-10-2024

Changeset: 21f8ccf4 Branch: master Author: Severin Gehwolf <sgehwolf@openjdk.org> Date: 2024-10-03 12:55:54 +0000 URL: https://git.openjdk.org/jdk/commit/21f8ccf4a97313593f210f9a07e56d5ff92b7aa5
03-10-2024

The PR in progress ( https://github.com/openjdk/jdk/pull/21289 ) is to skip the part of the test known to fail. Separate to that ACCESS_TMP_VIA_PROC_ROOT failure, there is another kind of failure happening, on Linux x64, with TMP_MOUNTED_INTO_SIDECAR. This might remain after the pending change, might need a further change. It's where the command: docker run --tty=true --rm --cap-add=SYS_PTRACE --sig-proxy=true --pid=container:test-container-main --cap-add=NET_BIND_SERVICE --user=10668:10668 --volumes-from test-container-main jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd /jdk/bin/jcmd -l ...gets no output, where a good run would show: [STDOUT] 1 EventGeneratorLoop 120 24 jdk.jcmd/sun.tools.jcmd.JCmd -l e.g. [main-container-process] MAIN_METHOD_STARTED, argument is 120 Attach strategy TMP_MOUNTED_INTO_SIDECAR [COMMAND] docker run --tty=true --rm --cap-add=SYS_PTRACE --sig-proxy=true --pid=container:test-container-main --cap-add=NET_BIND_SERVICE --user=10668:10668 --volumes-from test-container-main jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd /jdk/bin/jcmd -l [2024-10-03T04:30:35.273416534Z] Gathering output for process 12125 [ELAPSED: 1068 ms] [STDERR] [STDOUT] Full child process STDOUT was saved to docker-stdout-12125.log [2024-10-03T04:30:36.341378706Z] Waiting for completion for process 12125 [2024-10-03T04:30:36.341534140Z] Waiting for completion finished for process 12125 [COMMAND] docker rmi --force jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd [2024-10-03T04:30:36.349399928Z] Gathering output for process 12260 [ELAPSED: 27 ms] [STDERR] [STDOUT] Untagged: jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd Full child process STDOUT was saved to docker-stdout-12260.log ----------System.err:(16/748)---------- stdout: []; stderr: [] exitValue = 0 java.lang.RuntimeException: 'sun.tools.jcmd.JCmd' missing from stdout/stderr at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:253) at TestJcmdWithSideCar.testCase01(TestJcmdWithSideCar.java:135) at TestJcmdWithSideCar.main(TestJcmdWithSideCar.java:111) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:573) at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333) at java.base/java.lang.Thread.run(Thread.java:1576)
03-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21289 Date: 2024-10-01 16:16:36 +0000
01-10-2024

Filed JDK-8341349 to track the missing functionality.
01-10-2024

Seem to have reproduced. It looks like the EventGeneratorLoop program dies before the test finishes to run: [2024-10-01T10:02:40.158544644Z] Waiting for completion finished for process 16234 [main-container-process] ..............................EventGeneratorLoop is coming to an end and later: [COMMAND] podman run --tty=true --rm --cap-add=SYS_PTRACE --sig-proxy=true --pid=container:test-container-main --cap-add=NET_BIND_SERVICE --user=15263:15263 jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd /jdk/bin/jcmd -l [2024-10-01T10:03:08.449901823Z] Gathering output for process 16745 [ELAPSED: 1300 ms] [STDERR] [STDOUT] 83 jdk.jcmd/sun.tools.jcmd.JCmd -l Full child process STDOUT was saved to docker-stdout-16745.log Edit: This is a red herring. Not related to the test failure.
01-10-2024

Since this is a new case I propose to disable this specific test case and will file a new bug for the missing functionality.
01-10-2024

Reproducible when running the test with podman when run as regular user (non-root). It's the elevated test case with ACCESS_TMP_VIA_PROC_ROOT, which is not working. This works for the root user (--user 0:0). In one terminal: $ podman run --tty=true --rm --volume /disk/openjdk/upstream-sources/git/jdk-jdk/JTwork/classes/containers/docker/TestJcmdWithSideCar.d:/test-classes/ --user=$(id -u):$(id -g) --cap-add=NET_BIND_SERVICE --cap-add=SYS_PTRACE --name test-container-main --volume /tmp --volume /disk/openjdk/upstream-sources/git/jdk-jdk/JTwork/scratch/.:/workdir/ jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd /jdk/bin/java -XX:+ErrorFileToStderr -cp /test-classes/ -XX:+UsePerfData EventGeneratorLoop 30 MAIN_METHOD_STARTED, argument is 30 .. In another terminal: $ podman run -i --tty=true --rm --cap-add=SYS_PTRACE --sig-proxy=true --pid=container:test-container-main --cap-add=NET_BIND_SERVICE --user=$(id -u):$(id -g) jdk-internal:test-containers-docker-TestJcmdWithSideCar-jfr-jcmd bash bash-5.2$ /jdk/bin/jcmd -l 22 jdk.jcmd/sun.tools.jcmd.JCmd -l No EventGeneratorLoop process visible to jcmd, thus the test fails. It looks to me that this is a new test case and isn't guaranteed to work yet.
01-10-2024

Is this intermittent or 100% reproducible? I've run this test locally on cg v1/v2 and wasn't able to reproduce. So I wonder what it takes to reproduce.
01-10-2024