JDK-8231171 : remove remaining sun.java.launcher.pid references
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-09-18
  • Updated: 2019-09-30
  • Resolved: 2019-09-24
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 14
14 b16Fixed
Related Reports
Relates :  
Relates :  
Description
With  https://bugs.openjdk.java.net/browse/JDK-8078513
some code cleanup  relevant to LinuxThreads implementation  had been done.
However a few references to sun.java.launcher.pid  (which played a role in the removed old LinuxThreads ) remained. This should be cleaned up too.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/ef8c8cf9256a User: mbaesken Date: 2019-09-24 07:07:01 +0000
24-09-2019

On 18/09/2019 12:18 am, Baesken, Matthias wrote: > Hello, while looking at some atoi usages in the codebase I started to wonder about the "sun.java.launcher.pid" property. > Currently in java_md_solinux.c the property is set on Linux only by default (code is guarded #ifdef __linux__ ). > Later it is passed to the int variable _sun_java_launcher_pid (arguments.cpp) and can be retrieved by sun_java_launcher_pid() . > However only in src/hotspot/os/bsd/os_bsd.cpp it is really used. > > Is the property still supported (one would need to set it from user side on the command line on non-Linux because it is not set by default on bsd/macOS) ? > Can the coding be removed (or should it enabled for BSD/Mac like we do on Linux) ? > > The os_bsd comment mentiones the bug 6351349 : > > https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6351349 > JDK-6351349 : On linux with the old thread lib, jps should return the same PID as $! > > but this looks very old. That was the bug that added this code as it was needed on Linux with LinuxThreads. The code was then removed on Linux under https://bugs.openjdk.java.net/browse/JDK-8078513 The review thread starts here: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2015-May/014709.html I think we were focused solely on cleaning up the hotspot Linux code and didn't really look at the wider implication of the use of sun.java.launcher.pid. The code in os_bsd.cpp was simply copied from the Linux code without giving it any consideration - as you can tell from the comment: // With BsdThreads the JavaMain thread pid (primordial thread) // is different than the pid of the java launcher thread. // So, on Bsd, the launcher thread pid is passed to the VM // via the sun.java.launcher.pid property. where you can tell that Linux was simply replaced by Bsd, so we reference the non-existent BsdThreads So yes this all seems to be dead code that should be removed - core-libs folk will need to be involved of course as they own the launcher. It looks like SetJavaLauncherPlatformProps() can be removed completely.
18-09-2019