RFR: JDK-8263871: On sem_destroy() failing we should assert

Thomas Stuefe stuefe at openjdk.java.net
Fri Mar 19 15:56:51 UTC 2021


This is rather trivial.

We use anonymous Posix semaphores for some synchronization in hotspot. `sem_destroy()` can fail on some platforms with EBUSY if the semaphore has outstanding waiters. The glibc does not care, will happily wipe the sem_t structure and report success. But other Unices care (eg BSD, AIX, HP-UX) and refuse to close the semaphore, leaving the sem_t structure untouched.

It then happened for us that a new semaphore was created at the exact location of the old, still unclosed semaphore, and the unchanged sem_t structure was fed to sem_init(), which would fail with the same EBUSY error and trigger a guarantee.

One simple thing we should do is to assert success after closing a semaphore, as we do on all other semaphore operations. Granted, we won't see anything on Linux with glibc, but maybe shake loose errors on other platforms.

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

Commit messages:
 - wip

Changes: https://git.openjdk.java.net/jdk/pull/3089/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3089&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263871
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3089.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3089/head:pull/3089

PR: https://git.openjdk.java.net/jdk/pull/3089


More information about the hotspot-runtime-dev mailing list