JDK-8258057 : serviceability/attach/RemovingUnixDomainSocketTest.java doesn't ignore VM warnings
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-10
  • Updated: 2022-06-27
  • Resolved: 2020-12-17
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 17
17 b03Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The following test failed in the JDK16 CI:

serviceability/attach/RemovingUnixDomainSocketTest.java

Here's a snippet from the log file:

Command line: ['/opt/mach5/mesos/work_dir/jib-master/install/jdk-17+1-9/linux-x64-debug.jdk/jdk-17/fastdebug/bin/java' '-XX:MaxRAMPercentage=6' '-Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/tmp' '-XX:+UseBiasedLocking' '-cp' '/opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/classes/1/serviceability/attach/RemovingUnixDomainSocketTest.d:/opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/classes/1/test/lib' 'jdk.test.lib.apps.LingeredApp' '36570e76-43ad-42b5-87ef-d99c7d700ce2.lck']
[jcmd]:/opt/mach5/mesos/work_dir/jib-master/install/jdk-17+1-9/linux-x64-debug.jdk/jdk-17/fastdebug/bin/jcmd -J-XX:MaxRAMPercentage=6 -J-Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/tmp -J-XX:+UseBiasedLocking 30828 VM.version
[2020-12-11T03:48:22.112629869Z] Gathering output for process 30885
[jcmd] 30828:
[jcmd] Java HotSpot(TM) 64-Bit Server VM version 17-ea+1-LTS-9
[jcmd] JDK 17.0.0
[2020-12-11T03:48:23.555312891Z] Waiting for completion for process 30885
[2020-12-11T03:48:23.555599611Z] Waiting for completion finished for process 30885
jcmd stdout: [];
jcmd  stderr: []
jcmd  exitValue = 0
[2020-12-11T03:48:23.616345878Z] Waiting for completion for process 30885
[2020-12-11T03:48:23.616514194Z] Waiting for completion finished for process 30885
Remove /opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/tmp/.java_pid30828
[jcmd]:/opt/mach5/mesos/work_dir/jib-master/install/jdk-17+1-9/linux-x64-debug.jdk/jdk-17/fastdebug/bin/jcmd -J-XX:MaxRAMPercentage=6 -J-Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/983c483a-6907-44e0-ad29-98c7183575e2-S15022/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2d436720-52b7-4e30-88b3-ac04c49e361b/runs/e75e8ed6-c064-4f52-915f-31561738c7d4/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_serviceability/tmp -J-XX:+UseBiasedLocking 30828 VM.version
[2020-12-11T03:48:23.638297718Z] Gathering output for process 30937
[jcmd] 30828:
[2020-12-11T03:48:24.605480781Z] Waiting for completion for process 30937
[2020-12-11T03:48:24.605681628Z] Waiting for completion finished for process 30937
jcmd stdout: [Java HotSpot(TM) 64-Bit Server VM version 17-ea+1-LTS-9
JDK 17.0.0
];
jcmd  stderr: [Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
]
jcmd  exitValue = 0
[2020-12-11T03:48:24.605824988Z] Waiting for completion for process 30937
[2020-12-11T03:48:24.605954803Z] Waiting for completion finished for process 30937
[2020-12-11T03:48:24.613340465Z] Waiting for completion for process 30937
[2020-12-11T03:48:24.613517619Z] Waiting for completion finished for process 30937
 LingeredApp stdout: [];
 LingeredApp stderr: [Java HotSpot(TM) 64-Bit Server VM warning: Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
]
 LingeredApp exitValue = 0
----------System.err:(22/1282)----------
[jcmd] Java HotSpot(TM) 64-Bit Server VM warning: Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
 stdout: [Java HotSpot(TM) 64-Bit Server VM version 17-ea+1-LTS-9
JDK 17.0.0
];
 stderr: [Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.
]
 exitValue = 0

java.lang.RuntimeException: stderr was not empty
	at jdk.test.lib.process.OutputAnalyzer.stderrShouldBeEmptyIgnoreVMWarnings(OutputAnalyzer.java:145)
	at RemovingUnixDomainSocketTest.runJCmd(RemovingUnixDomainSocketTest.java:69)
	at RemovingUnixDomainSocketTest.main(RemovingUnixDomainSocketTest.java:88)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test

Comments
Looks like over a year ago I ran into this same type of problem with the use of ProcessTools and OutputAnalyzer together. See JDK-8233725. Basically the following is not supported: p = ProcessTools.startProcess("java", pb); out = new OutputAnalyzer(p); And neither is: p = ProcessTools.startProcess("java", pb, outputConsumer); out = new OutputAnalyzer(p);
08-01-2021

Changeset: 7b05439d Author: Patricio Chilano Mateo <pchilanomate@openjdk.org> Date: 2020-12-17 16:41:50 +0000 URL: https://git.openjdk.java.net/jdk/commit/7b05439d
17-12-2020

Simple solution would be to run the jcmd command like this instead: ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(jcmd.getCommand()); OutputAnalyzer out = ProcessTools.executeProcess(pb); In order to avoid hiding all warnings which might not be desired (see JDK-8248162) we can filter from stderr only those lines that contain the "was deprecated" string.
10-12-2020

ProcessTools.startProcess() starts the process and creates its own StreamPumper objects to process stdout and stderr. Those will consume the output of the process and print it to System.out and System.err respectively, with some minor line formatting. Later we create the new OutputAnalyzer object, which also creates its own StreamPumper objects to process the stdout and stderr of the executed process. This time the output consumed is written to a ByteArrayOutputStream instead, and later read with getStdout() and getStderr(). This two sets of StreamPumper objects conflict with each other since they are consuming from the same streams. In the failing cases, part of the stderr output is read by one and part by the other one. In particular, the StreamPumper processing thread created in ProcessTools.startProcess() consumes "OpenJDK 64-Bit Server VM warning:", while the one created by OutputAnalyzer consumes the rest, i.e "Option UseBiasedLocking was deprecated in version 15.0 and will likely be removed in a future release.". So now since out.getStderr() is not empty and does not contain the string "VM warning:" anymore, the test fails.
10-12-2020