RFR(xs): 8220173: assert(_handle_mark_nesting > 1) failed: memory leak: allocating handle outside HandleMark

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Mar 7 16:06:10 UTC 2019


On 3/7/19 10:36 AM, Robbin Ehn wrote:
> Hi Dan,
>
>>      L297:     HandleMark hm;
>>          This should be "HandleMark hm(thread);".
>
> Thanks, fixed!
>
>>
>> I only took a quick look at clear_handshake() and do_handshake(), but
>> I'm not grokking the reason for the CautiouslyPreserveExceptionMark
>> helper. You use those when you want to preserve a possible pending
>> exception that you have in hand now when you're about to execute code
>> that might generate another (unexpected) exception. I'm not seeing
>> where clear_handshake() or do_handshake() are doing anything that
>> might generate another Java exception. However, I only took a quick
>> look so maybe I missed something. So what am I missing?
>
> do_handshake execute unknown code supplied in the ThreadClousure for 
> the handshake here:
>
>   // Only actually execute the operation for non terminated threads.
>   if (!thread->is_terminated()) {
>     _thread_cl->do_thread(thread);
>   }
>
> The reasoning was that this might generate a second exception.

Thanks for the explanation. I'm good with it.

Dan


> I think that any code inside a handshake should make sure not generate 
> an exception. But for now I just did this.
>
>>
>> Thumbs up on the change itself. Would be good to know the answer to
>> my question above.
>
> Thanks, Robbin
>
>>
>> Dan
>>
>>
>>>
>>> A thread have a pending exception and we try to handleize the oop 
>>> without a HandleMark before the handshake.
>>> The CautiouslyPreserveExceptionMark should only cover the handshake 
>>> operation not the transition, so moved that into proper scope and 
>>> added HandleMark.
>>>
>>> Passes t1.
>>>
>>> Thanks Robbin
>>



More information about the hotspot-runtime-dev mailing list