RFR: 8253429: Error reporting should report correct state of terminated/aborted threads

David Holmes dholmes at openjdk.java.net
Mon Sep 28 05:19:17 UTC 2020


On Fri, 25 Sep 2020 15:03:29 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> src/hotspot/share/runtime/thread.cpp line 919:
>> 
>>> 917:     osthread()->print_on(st);
>>> 918:
>>> 919:     if (osthread()->get_state() != ZOMBIE) {
>> 
>> I'm not sure print_on(), as opposed to print_on_error() can ever be called with a ZOMBIE thread. I didn't expect any
>> change in this method.
>
> For thread, e.g. G1ConcurrentMarkThread, there is nothing to prevent calling _cm_thread->print_on(tty) after it
> terminated, although, I can not find a case right now.
> You prefer an assertion instead?

I prefer no change to this method. I don't see that we need to do anything special even if a ZOMBIE could be
encountered.

>> src/hotspot/share/runtime/thread.cpp line 955:
>> 
>>> 953:     }
>>> 954:   } else {
>>> 955:     st->print(" Aborted");
>> 
>> Not sure this is reachable and if it is then I'm not sure what state the thread is actually in. If a Thread never gets
>> an osThread() it isn't started so shouldn't be locatable by any means.
>
> so, you prefer "ShouldNotReachHere()" ?

There's no point putting a ShouldNotReachHere() in error handling code as we will just trip a secondary error.
If we want to print something the perhaps "unknown state (no osThread)" ?
Also I only wanted the ThreadSMRSupport::print_info_on to be excluded for Zombies, but you've excluded it for the
no-osThread case as well. I think based on what Dan said we can just put that back and call it unconditionally. Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/341


More information about the hotspot-runtime-dev mailing list