RFR: 8298377: JfrVframeStream causes deadlocks in ZGC [v2]

Stefan Karlsson stefank at openjdk.org
Thu Jan 19 13:54:08 UTC 2023


On Wed, 18 Jan 2023 13:00:46 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>>> > > Question: does the "start_processing()" call ever reach a malloc, directly or indirectly? If so, it is problematic to call from the sampler thread.
>>> > 
>>> > 
>>> > It does allocate a stack iterator with malloc if it really did need to start processing and it was not yet started. So yes. Would you mind explaining why using malloc is problematic?
>>> 
>>> The problem is that the suspendee can be holding the malloc lock. Please see https://bugs.openjdk.org/browse/JDK-8274298 for an example situation.
>> 
>> Right - that makes sense. But I thought the processing is poked here before we suspend the target thread? Or did I read the code wrong?
>
>> > > > Question: does the "start_processing()" call ever reach a malloc, directly or indirectly? If so, it is problematic to call from the sampler thread.
>> > > 
>> > > 
>> > > It does allocate a stack iterator with malloc if it really did need to start processing and it was not yet started. So yes. Would you mind explaining why using malloc is problematic?
>> > 
>> > 
>> > The problem is that the suspendee can be holding the malloc lock. Please see https://bugs.openjdk.org/browse/JDK-8274298 for an example situation.
>> 
>> Right - that makes sense. But I thought the processing is poked here before we suspend the target thread? Or did I read the code wrong?
> 
> Ah. The call is now located before the suspend is attempted. That is good from a sampling perspective. Is it mt safe to call start_processing() on another running thread?

@mgronlun Like this?

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

PR: https://git.openjdk.org/jdk/pull/11586


More information about the hotspot-jfr-dev mailing list