[jdk17] RFR: 8269865: Async UL needs to handle ERANGE on exceeding SEM_VALUE_MAX

Xin Liu xliu at openjdk.java.net
Tue Jul 13 01:41:57 UTC 2021


On Tue, 13 Jul 2021 01:18:28 GMT, David Holmes <david.holmes at oracle.com> wrote:

> But we already circumvent that for async logging. We can't use async
logging until after we have called AsyncLogWriter::initialize(). So the
synchronization objects used by AsyncLogWriter can be plain
Mutex/Monitor, they don't need to be Semaphore.

That is not true. I deleted finalize() because it was complex and not necessary after we switch from Monitor to Semaphore. 
A thread may emit logs even it has deletes itself. 

I reviewed this line. https://github.com/apple/darwin-xnu/blob/main/osfmk/kern/sync_sema.c#L400
In my understanding, `semaphore_signal` will try to wait up one in the wait queue of the semaphore. if kr != KERN_SUCCESS, it will reset counter to 0 because no one is waiting on that. In our case, we should take this route.  I think the behavior is defined. 

thanks,
--lx

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

PR: https://git.openjdk.java.net/jdk17/pull/216


More information about the hotspot-runtime-dev mailing list