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

Daniel D.Daugherty dcubed at openjdk.java.net
Wed Sep 30 17:05:55 UTC 2020


On Thu, 24 Sep 2020 18:14:10 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> For some non-JavaThread, their object instances can outlast threads' lifespan. For example, we still can query/report
> thread's state after thread terminated.
> But the query/report currently returns wrong state. E.g. a terminated thread appears to be alive and seemly has valid
> thread stack, etc.
> This patch sets non-JavaThread's state to ZOMBIE just before it terminates, so that we can distinguish terminated
> thread from live thread.
> Also, thread should not report its SMR info, if it has terminated or it never started (thread->osthread() == NULL).
> 
> Note: Java thread does not have such issue, its thread object is deleted before thread terminates.

Changes requested by dcubed (Reviewer).

src/hotspot/share/runtime/thread.cpp line 1345:

> 1343:   // Ensure thread-local-storage is cleared before termination.
> 1344:   Thread::clear_thread_current();
> 1345:   osthread()->set_state(ZOMBIE);

I'm okay with this change as a debugging marker that the non-JavaThread
has terminated.

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

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


More information about the hotspot-runtime-dev mailing list