RFR: 8273608: Deadlock when jcmd of OnError attaches to itself [v7]

Xin Liu xliu at openjdk.java.net
Tue Oct 12 06:08:52 UTC 2021


On Tue, 12 Oct 2021 05:25:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert JavaThreadInVMAndNative change.
>>   
>>   Only change the state to Native if current thread is Java Thread and it's in VM.
>>   Restore thread state after fork_and_exec() if it's changed.
>
> src/hotspot/share/utilities/vmError.cpp line 1348:
> 
>> 1346:  public:
>> 1347:   VMErrorForceInNative(Thread* t): _jt(t != NULL && t->is_Java_thread() ? JavaThread::cast(t) : NULL) {
>> 1348:     if (_jt != NULL && _jt->thread_state() == _thread_in_vm) {
> 
> What if it is _thread_in_Java? Isn't that possible.
> 
> I think you can unconditionally change the state to `_thread_in_native` and then restore it.

> //  _thread_in_Java     : Executing either interpreted or compiled Java code (or could be in a stub)

you mean it's possible to be here from interpreter, or compiled code? 
Hotspot runtime is so complex. I can't wrap my head around it.

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

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


More information about the hotspot-dev mailing list