RFR: 8029630: Print thread id hex representation in error messages.

Thomas Stüfe thomas.stuefe at gmail.com
Fri Apr 3 09:42:03 UTC 2015


Hi Max,

Disclaimer: not a Reviewer.

In thread.cpp, the code prints the value of Thread* pointer, not a thread
id. So the code was correct before.

That said, I find this pretty confusing, especially because it prints
"tid=<this>". Maybe one should change this or throw it away.

--

As for vmError.cpp: this seems to be correct.

However, I would like to see this abstracted somehow, here is why:

The OpenJDK simply assumes thread id to be 32bit unsigned. This is not
really portable and may bite us in the face (I am not sure if it already
did, was not thread id 64bit on AIX? at least for kernel thread ids?).

If you use pthread_t to implement thread id, like many ports do, thread id
may be anything - 64bit number, array, struct. POSIX leaves that open.

So, instead of a raw "%x", I propose as quick fix a format specifier for
thread ids, e.g. "THREAD_ID_FORMAT". That way we could at least easily find
all places where we print thread ids, if we later decide to change the type
for thread ids.

Regards, Thomas


On Thu, Apr 2, 2015 at 9:38 PM, Max Ockner <max.ockner at oracle.com> wrote:

> Hello,
> Please review this change:
>
> Bug:  https://bugs.openjdk.java.net/browse/JDK-8029630
> Webrev: http://cr.openjdk.java.net/~mockner/8029630.2/
> Summary: Existing error messages for vm crashes print the decimal
> representation of the current thread id. The message format has been
> changed to print the hex value of the thread id.
>
> Tested with jtreg runtime to make sure nothing was broken. I tested the
> new functionality separately. I crashed the vm and examined the debugger
> output to make sure the hexadecimal thread id printed in the error message
> matched one of the threads listed by the debugger.
>
> Thanks,
> Max
>


More information about the hotspot-dev mailing list