RFR: 8225543: Jcmd fails to attach to the Java process on Linux using the main class name if whitespace options were used to launch the process

Daniil Titov daniil.x.titov at oracle.com
Mon Jun 10 23:55:37 UTC 2019


Please review the change that fixes jcmd process name matching on Linux platform.

After changes [3] , on Linux platform the proc filesystem is used to find a Java process, however, sun.tools.ProcessHelper  class, 
introduced in that change, didn't take into account the presence of module whitespace options ( e.g. --patch-module) or the 
fact that some values of Java options could contain whitespaces.

The latter problem is fixed by keeping '\0' as a separator for command line arguments read from /proc/{pid}/cmdline rather than 
replacing it with a whitespace. The former problem is fixed by making sun.tools.ProcessHelper  aware of these module whitespace
 options (--add-opens, --add-exports,--add-reads, --add-modules, --patch-module,--limit-modules, or --upgrade-module-path) as well
 as of the case when a source-file mode is used or when --module options is used in "--<name>=<value>" format.

Testing: sun/tools/jcmd and serviceability/dcmd/framework tests succeeded in Mach5. jdk_svc, tier1, tier2, and tier3 tests are in progress. 


[1] Webrev: http://cr.openjdk.java.net/~dtitov/8225543/webrev.01/ 
[2] Bug: https://bugs.openjdk.java.net/browse/JDK-8225543 
[3]  https://bugs.openjdk.java.net/browse/JDK-8205654 

Thanks!
--Daniil




More information about the serviceability-dev mailing list