JDK-8228960 : [TESTBUG] containers/docker/TestJcmdWithSideCar.java: jcmd reports main class as 'Unknown'
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-07-31
  • Updated: 2024-07-09
  • Resolved: 2019-08-29
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 14
11.0.24-oracleFixed 14 b13Fixed
Related Reports
Relates :  
Relates :  
Description
Failure: java.lang.RuntimeException: 'EventGeneratorLoop' missing from stdout/stderr 

What happened:  Test runs 'jcmd -l', and expects to see a "EventGeneratorLoop" class in JCMD's output, but instead the output shows 'Uknown'.
See the output below.

[COMMAND]
docker run --tty=true --rm --cap-add=SYS_PTRACE --sig-proxy=true --pid=container:test-container-main --volumes-from test-container-main jdk-internal:test-jfr-jcmd /jdk/bin/jcmd -l 
[2019-07-31T17:41:21.700199Z] Gathering output for process 12953
[ELAPSED: 3 ms]
[STDERR]

[STDOUT]
1 Unknown
21 jdk.jcmd/sun.tools.jcmd.JCmd -l
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk11u-dev/pull/2822 Date: 2024-06-27 10:36:59 +0000
09-07-2024

Applied review recommendations from David and Bob, ran test another 30 times on the cluster - All PASS
29-08-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/fd09c637dedb User: mseledtsov Date: 2019-08-29 22:51:20 +0000
29-08-2019

Using output of the child process to detect when the main() method have started, prior to running the 'jcmd' tests. Updated webrev: http://cr.openjdk.java.net/~mseledtsov/8228960.02/ Testing: Ran 50 times on variety of Linux-x64 nodes - All PASS
23-08-2019

Webrev: http://cr.openjdk.java.net/~mseledtsov/8228960.00/ Testing: 1. Locally: ran test 50 times on Linux-x64 2. Test Cluster: ran several dozen times on a variety of Linux-x64 host, including the hosts where the original failure was detected.
07-08-2019

My current theory: JCMD -l shows 'Unknown' for class name most likely because the main class has not been loaded yet. Could be a timing issue: the JVM has started, it is initializing, but has not loaded the main class yet. Proposed solution: - increase the initial delay between the start of the "observee container" and the launching of 'jcmd -l' - add several runs of 'jcmd -l' with checks in the loop. Say, check 5 times with 500ms delay, instead of checking just once.
31-07-2019