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

David Holmes dholmes at openjdk.java.net
Wed Jul 14 01:47:20 UTC 2021


On Wed, 14 Jul 2021 01:38:40 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> This patch solved the sempahore overflow issue with errno ERANGE or EOVERFLOW.
>> Previously, we have asymmetric p/v operations for semaphore _sem. Each iteration
>> only decrements _sem 1 but dequeues N messages. If logging threads keep preempting
>> async logging thread, it may cause the value of _sem accumulates until overflow! 
>> 
>> We decide to ditch counting semaphore.  os::PlatformMonitor can be used as low-level 
>> combination of Mutex/CondVar.  It may work if we simply ignore Semaphore::signal failure 
>> due to value overflow, but we have to pollute Semaphore interface.  Also it seems that MacOS
>> semaphore which is non-posix doesn't fail in this case.
>
> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add a comment to explain why we choose os::PlatformMonitor over Semaphore.

Marked as reviewed by dholmes (Reviewer).

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

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


More information about the hotspot-runtime-dev mailing list