RFR(s): 8149036: Add UL tracing for thread related events at os level

Thomas Stüfe thomas.stuefe at gmail.com
Tue Feb 23 09:24:22 UTC 2016


Hi Coleen,

thank you for the review!

See here the new webrev:

http://cr.openjdk.java.net/~stuefe/webrevs/8149036-add-tracing-for-thread-events/webrev.01/webrev/index.html

Ok, to separate the logging from the strerror issue, I replaced the
offending calls to os::errno_name() with plain strerror() on the base that
this is the way we do it now all over the hotspot (although we know it is
broken). I do not like much adding broken code to broken code, but all
alternatives (strerror_s, os::lasterror()) I like even less.

As for the strerror issue, this may be a larger discussion, so I added my
comments to the bug David opened.

Kind Regards, Thomas


On Tue, Feb 23, 2016 at 12:09 AM, Coleen Phillimore <
coleen.phillimore at oracle.com> wrote:

>
> Oh, also, I am willing to sponsor this.
> Thanks,
> Coleen
>
>
> On 2/22/16 5:45 PM, Coleen Phillimore wrote:
>
>>
>>
>> On 2/22/16 3:53 PM, Coleen Phillimore wrote:
>>
>>>
>>> Hi Thomas,
>>> I think the logging conversion looks really good.  The errno stuff is
>>> very ugly though.  Can you call strerrno_r - the thread safe version?  I
>>> didn't see discussion around this.
>>>
>>
>> Hi Thomas, I was talking to Kim.  You should use strerror() and not add
>> this code to os.cpp. The rationale is in this bug:
>>
>> https://bugs.openjdk.java.net/browse/JDK-6223913
>>
>> It seems like the errors would have standard errno at this point and
>> wouldn't be susceptible to the race in strerror().
>>
>> +        log.warning("Failed to start thread - pthread_create failed (%s)
>> for attributes: %s.",
>> +          os::errno_name(errno), os::Posix::describe_pthread_attr(buf,
>> sizeof(buf), &attr));
>>
>> It seems the chance of a race creating different errno at this early
>> point in the jvm is very low.
>>
>> Coleen
>>
>> Thanks,
>>> Coleen
>>>
>>> On 2/22/16 11:54 AM, Thomas Stüfe wrote:
>>>
>>>> Dear all,
>>>>
>>>> please take a look at this proposed addition to UL. This adds a number
>>>> of
>>>> trace points to thread creation. In detail:
>>>>
>>>> - it traces thread creation and thread creation errors, including
>>>> pthread
>>>> attributes (for Posix platforms)
>>>> - it traces stack location and creation/removal of stack guard pages.
>>>>
>>>> This all was first AIX-only tracing, but I converted this to UL and
>>>> made it
>>>> available on all platforms.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8149036
>>>> Webrev:
>>>>
>>>> http://cr.openjdk.java.net/~stuefe/webrevs/8149036-add-tracing-for-thread-events/webrev.00/webrev/
>>>>
>>>> Note also that I added a helper function, os::errno_name(), which is a
>>>> very
>>>> simple replacement for strerror() without its problems (thread safety,
>>>> unwanted localizations...).
>>>>
>>>> What do you think?
>>>>
>>>> Kind Regards, Thomas
>>>>
>>>
>>>
>>
>


More information about the hotspot-runtime-dev mailing list