RFR: 8268165: AsyncLogging will crash if rotate() fails [v2]

Xin Liu xliu at openjdk.java.net
Mon Jun 7 00:45:01 UTC 2021


On Mon, 7 Jun 2021 00:00:43 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> Looks good.
> 
> I wonder why we use semaphore instead of mutex for `_rotation_semaphore`, but it's not yours.

Thanks for reviewing it. 

I can try to answer this.  Synchronous logging writing may happen anywhere and anytime. 
hotspot's mutex requires Thread::current().  We can't assume that in very early stage or very late stage, or it will fail this assertion. 

  assert(current != NULL, "Thread::current() called on detached thread");


eg. this logsite is invoked after `delete thread;`.  
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/threadSMR.cpp#L1027

Semaphore doesn't have this constraint.

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

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


More information about the hotspot-runtime-dev mailing list