RFR: JDK-8152690: main thread does not have native thread name
gerard.ziemski at oracle.com
Tue Apr 19 12:54:58 UTC 2016
> On Apr 19, 2016, at 12:04 AM, David Holmes <david.holmes at oracle.com> wrote:
> On 19/04/2016 9:28 AM, Yasumasa Suenaga wrote:
>> Hi Gerard,
>> 2016/04/19 3:14 "Gerard Ziemski" <gerard.ziemski at oracle.com
>> <mailto:gerard.ziemski at oracle.com>>:
>> > hi Yasumasa,
>> > Nice work. I have 2 questions:
>> > ========
>> > File: java.c
>> > #1 Shouldn’t we be checking for “(*env)->ExceptionOccurred(env)”
>> after every single JNI call? In this example instead of NULL_CHECK,
>> should we be using CHECK_EXCEPTION_NULL_LEAVE macro?
>> It is not critical if we encounter error at JNI function call because
>> we cannot set native thread name only.
>> So I think that we do not need to leave from launcher process.
> I agree we do not need to abort if an exception occurs (and in fact I don't think an exception is even possible from this code), but we should ensure any pending exception is cleared before any futher JNI calls might be made. Note that NULL_CHECK is already used extensively throughout the launcher code - so if this usage is wrong then it is all wrong! More on this code below ...
Isn’t there a risk that:
(*env)->CallVoidMethod(env, currentThread, setNativeNameID,
+ nameString, JNI_TRUE);
will raise an exception?
In the least, shouldn’t we clear any possible pending exceptions at the beginning of “SetNativeThreadName“, as you say, but also at the very end?
More information about the core-libs-dev