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

Xin Liu xliu at openjdk.java.net
Wed Jul 14 01:47:21 UTC 2021


On Tue, 6 Jul 2021 06:43:24 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.

This pull request has now been integrated.

Changeset: 67273ae6
Author:    Xin Liu <xliu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17/commit/67273ae63c3dbebccf124929c13a363dea05a0da
Stats:     25 lines in 2 files changed: 11 ins; 5 del; 9 mod

8269865: Async UL needs to handle ERANGE on exceeding SEM_VALUE_MAX

Reviewed-by: dholmes, pchilanomate

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

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


More information about the hotspot-runtime-dev mailing list