RFR: 8285794: AsyncGetCallTrace might acquire a lock via JavaThread::thread_from_jni_environment [v4]
Martin Doerr
mdoerr at openjdk.java.net
Thu May 5 09:38:20 UTC 2022
On Tue, 3 May 2022 08:02:57 GMT, Johannes Bechberger <duke at openjdk.java.net> wrote:
>> Calling JavaThread::thread_from_jni_environment for a terminated thread in AsyncGetCallTrace might cause the acquisition of a lock, making AsyncGetCallTrace non-signal-safe.
>>
>> AsyncGetCallTrace can only be called for the current threads (there are asserts for that), therefore using JavaThread::current directly and checking the termination status is semantically equivalent.
>
> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>
> Merge cast into condition
LGTM.
src/hotspot/share/prims/forte.cpp line 571:
> 569: JavaThread* thread;
> 570:
> 571: if (trace->env_id == NULL || raw_thread == NULL || !raw_thread->is_Java_thread() || (thread = JavaThread::cast(raw_thread))->is_exiting()) {
Line is a bit long! (There are other long lines in this file, too, so, I can live with it.)
-------------
Marked as reviewed by mdoerr (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8446
More information about the serviceability-dev
mailing list