Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: "Burd, Greg" <greg@burd.me>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Gavin Panella <gavinpanella@gmail.com>, pgsql-hackers@postgresql.org
Date: 2025-08-16T03:04:47Z
Lists: pgsql-hackers
On Sat, Aug 16, 2025 at 2:25 PM Thomas Munro <thomas.munro@gmail.com> wrote: > Supposing posix_sema.c checked that the maximum number of backends > didn't exceed SEM_VALUE_MAX and refused to start up if so (I suppose > today if you later exceed it in sem_post() you'll get either FATAL: > EOVERFLOW on POSIX 2024 systems or unspecified behaviour, likely > including a hang due to a corrupted counter, I guess). And just by the way, each backend has its own semaphore, so in actual usage we're probably only talking about the "superfluous wakeups" mentioned in lwlock.c, clog.c and procarray.c. I suppose it's not expected to go very high at all? I was just trying to think about where the bounds on that come from in theory, while working through the case for ignoring EOVERFLOW...
Commits
-
Don't treat EINVAL from semget() as a hard failure.
- 21fddb3d7690 19 (unreleased) landed
- f4c0883448d8 15.15 landed
- e67d5f7baa7d 16.11 landed
- e3b3fa863810 13.23 landed
- b3d6e8b63bc1 14.20 landed
- ab92f0e7f7d7 17.7 landed
- 787cd2b7d5cd 18.0 landed
-
Give up on running with NetBSD/OpenBSD's default semaphore settings.
- 810a8b1c8051 18.0 cited