[RFR] 8231171: remove remaining sun.java.launcher.pid references - was RE: sun.java.launcher.pid property usage

David Holmes david.holmes at oracle.com
Thu Sep 19 08:55:47 UTC 2019


Hi Matthias,

Thanks for cleaning this up.

On 19/09/2019 4:57 pm, Baesken, Matthias wrote:
> Hello, as discussed below ,   I want to cleanup  some older references to sun.java.launcher.pid.
> Please review the following change.
> 
> After removal  of some code belonging  old  LinuxThreads   (JDK-8078513)   , the   sun.java.launcher.pid   handling code remained  but
>   seems to be  obsolete these days .
> 
> Bug/webrev :
> 
> https://bugs.openjdk.java.net/browse/JDK-8231171
> 
> http://cr.openjdk.java.net/~mbaesken/webrevs/8231171.0/

src/hotspot/os/bsd/os_bsd.cpp

Can you delete the entire comment block here:

1126   // Under the old bsd thread library, bsd gives each thread
...
1140   // OSThread::thread_id() method in osThread_bsd.hpp file

as it was simply copied from Linux and is nonsense on BSD.

Otherwise that all looks good to me. No need for an updated webrev.

Thanks,
David
-----

> Best regards, Matthias
> 
> 
>>
>> Hi David, thanks for the additional  information .
>> I opened
>>
>> https://bugs.openjdk.java.net/browse/JDK-8231171
>>
>> 8231171: remove reamining sun.java.launcher.pid references
>>
>>    to do the additional cleanup .
>>
>> Best regards, Matthias
>>
>>
>>> -----Original Message-----
>>> From: David Holmes <david.holmes at oracle.com>
>>> Sent: Mittwoch, 18. September 2019 03:16
>>> To: Baesken, Matthias <matthias.baesken at sap.com>; 'hotspot-
>>> dev at openjdk.java.net' <hotspot-dev at openjdk.java.net>
>>> Subject: Re: sun.java.launcher.pid property usage
>>>
>>> Hi Matthias,
>>>
>>> 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 focussed 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.
>>>
>>> Thanks,
>>> David
> 


More information about the hotspot-dev mailing list