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

David Holmes david.holmes at oracle.com
Tue Oct 12 12:02:55 UTC 2021


On 12/10/2021 4:08 pm, Xin Liu wrote:
> 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.

A crash can happen in any code.

David

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


More information about the hotspot-dev mailing list