[jdk17] RFR: 8269865: Async UL needs to handle ERANGE on exceeding SEM_VALUE_MAX
David Holmes
david.holmes at oracle.com
Tue Jul 13 03:03:12 UTC 2021
On 13/07/2021 11:41 am, Xin Liu wrote:
> 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.
Ah - sorry. I was looking at the VM initialization issue not the thread
termination issue. Pity.
> 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.
Sorry but there is no way I'm going to trust any ad-hoc guesses about
what exactly that code will do. I don't know any of the invariants of
the data structure, exactly what the different fields represent, or how
exactly they are maintained. Heck we don't even know that really is the
code involved!
I will continue to think this about this problem, but I'm not seeing any
solution I like so far.
Thanks,
David
-----
>
> thanks,
> --lx
>
> -------------
>
> PR: https://git.openjdk.java.net/jdk17/pull/216
>
More information about the hotspot-runtime-dev
mailing list