[jdk19] RFR: 8289091: move oop safety check from SharedRuntime::get_java_tid() to JavaThread::threadObj() [v2]

David Holmes dholmes at openjdk.org
Mon Jun 27 22:54:44 UTC 2022


On Mon, 27 Jun 2022 21:00:47 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> A trivial move of the oop safety check from SharedRuntime::get_java_tid() to
>> JavaThread::threadObj(). Also made adjustments to the threadObj() calls in
>> JavaThread::print_on_error() and JavaThread::get_thread_name_string() so
>> that we don't get secondary crashes when a JavaThread crashes after it has
>> detached the GC barrier.
>> 
>> Tested with Mach5 Tier[1-7]. A Mach5 Tier8 will be started this weekend.
>
> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
> 
>   dholmes CR - check if current thread's oop access is safe.

Sorry Dan have to revoke my approval. There are still some issues here that need fixing and I don't like the impact on the code.

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

> 2218:   if (current == nullptr) {
> 2219:     // Current thread is not attached so it can't safely determine this
> 2220:     // JavaThread's name so use the default thread name.

This should not be possible, but again `current_or_null_safe` should be used.

Though this code is used a lot in normal operation so the additional overhead of this is more significant than the print_on_error case.

I think this check should be moved to the caller if  needed (ie the print_on_error code), as in normal use it is not possible to fail this check.

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

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.org/jdk19/pull/69


More information about the hotspot-runtime-dev mailing list