Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gavin Panella <gavinpanella@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2025-08-10T22:56:00Z
Lists: pgsql-hackers
I wrote:
> I didn't try other BSDen; this might be a NetBSD-ism that Apple
> inherited, or maybe it's common among the BSDen.

A bit more research later: OpenBSD behaves like NetBSD, while
FreeBSD behaves like Linux.  So that's pretty inconclusive about
what the aboriginal behavior was.  I also found that OpenIndiana
behaves like Linux.

For Linux and FreeBSD, it doesn't actually matter to us because
we no longer use SysV semaphores on those platforms.  But this
is a live problem on macOS, NetBSD, OpenBSD.

			regards, tom lane



Commits

  1. Don't treat EINVAL from semget() as a hard failure.

  2. Give up on running with NetBSD/OpenBSD's default semaphore settings.