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

Xin Liu xliu at openjdk.java.net
Wed Jul 14 01:38:40 UTC 2021


> 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.

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

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/216/files
  - new: https://git.openjdk.java.net/jdk17/pull/216/files/0816eb2d..f6a9fd58

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17&pr=216&range=07
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17&pr=216&range=06-07

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/216.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/216/head:pull/216

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


More information about the hotspot-runtime-dev mailing list