From 38da053463bef32adf563ddee5277d16d2b6c5af Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Dec 2024 16:46:07 -0500 Subject: Try to avoid semaphore-related test failures on NetBSD/OpenBSD. These two platforms have a remarkably tight default limit on the number of SysV semaphores in the system: SEMMNS is only 60 out-of-the-box. Unless manual action is taken to raise that, we'll only be able to allocate 3 sets of 16 usable semaphores each, leading to initdb setting max_connections to just 20. That's problematic because the core regression tests expect to be able to launch 20 concurrent sessions, leaving us with no headroom. This seems to be the cause of intermittent buildfarm failures on some machines. While there's no getting around the fact that you'd better raise SEMMNS for production use on these platforms, it does seem desirable for "make check" to pass reliably without that. We can make that happen, at least for awhile longer, with two small changes: * Change sysv_sema.c's SEMAS_PER_SET to 19, so that we can eat up all of the available semas not just most of them. * Change initdb to make the smallest max_connections value it will consider be 25 not 20. As of HEAD this will leave us with four free semaphores (using the default values for other relevant parameters such as max_wal_senders). So we won't need to consider this again until we've invented five more background processes. Maybe by then we can switch both these platforms to some other semaphore API. For the moment, do this only in master; there've not been field complaints that might justify a back-patch. Discussion: https://postgr.es/m/db2773a2-aca0-43d0-99c1-060efcd9954e@gmail.com --- doc/src/sgml/runtime.sgml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 94135e9d5ee..8750044852d 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -782,19 +782,19 @@ psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such SEMMNI Maximum number of semaphore identifiers (i.e., sets) - at least ceil(num_os_semaphores / 16) plus room for other applications + at least ceil(num_os_semaphores / 19) plus room for other applications SEMMNS Maximum number of semaphores system-wide - ceil(num_os_semaphores / 16) * 17 plus room for other applications + ceil(num_os_semaphores / 19) * 20 plus room for other applications SEMMSL Maximum number of semaphores per set - at least 17 + at least 20 @@ -841,7 +841,7 @@ psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such (), allowed autovacuum worker process (), allowed WAL sender process (), allowed background - process (), etc., in sets of 16. + process (), etc., in sets of 19. The runtime-computed parameter reports the number of semaphores required. This parameter can be viewed before starting the server with a postgres command like: @@ -851,17 +851,17 @@ $ postgres -D $PGDATA -C num_os_semaphores - Each set of 16 semaphores will - also contain a 17th semaphore which contains a magic + Each set of 19 semaphores will + also contain a 20th semaphore which contains a magic number, to detect collision with semaphore sets used by other applications. The maximum number of semaphores in the system is set by SEMMNS, which consequently must be at least as high as num_os_semaphores plus one extra for - each set of 16 required semaphores (see the formula in ). The parameter SEMMNI determines the limit on the number of semaphore sets that can exist on the system at one time. Hence this parameter must be at - least ceil(num_os_semaphores / 16). + least ceil(num_os_semaphores / 19). Lowering the number of allowed connections is a temporary workaround for failures, which are usually confusingly worded No space -- cgit v1.2.3