Download raw body.
Update PostgreSQL README regarding Sys V semaphores
I committed this change. I also did some more research and this change
in PostgreSQL 18 is deliberate:
https://github.com/postgres/postgres/commit/810a8b1c8051d4e8822967a96f133692698386de
Jeremy
On 12/05 06:43, Jeremy Evans wrote:
> I received a report that the default semmns limit is no longer sufficient
> to start PostgreSQL. Instead of reducing the number of max connections,
> it just will not start. Here's the initdb output you get with the default
> limits:
>
>
> running bootstrap script ... 2025-12-05 18:41:22.252 PST [50524] FATAL: could not create semaphores: No space left on device
> 2025-12-05 18:41:22.252 PST [50524] DETAIL: Failed system call was semget(311051, 17, 03600).
> 2025-12-05 18:41:22.252 PST [50524] HINT: This error does *not* mean that you have run out of disk space. It occurs when either the system limit for the maximum number of semaphore sets (SEMMNI), or the system wide maximum number of semaphores (SEMMNS), would be exceeded. You need to raise the respective kernel parameter. Alternatively, reduce PostgreSQL's consumption of semaphores by reducing its "max_connections" parameter.
> The PostgreSQL documentation contains more information about configuring your system for PostgreSQL.
> child process exited with exit code 1
> initdb: removing contents of data directory "/var/postgresql/data"
>
>
> The postgresql-server pkg README has recommended these limits for a
> long time:
>
> kern.seminfo.semmni=256
> kern.seminfo.semmns=2048
>
> I think we should adjust the text of the README to reflect the
> behavior change starting in PostgreSQL 18.
>
> OKs?
>
> Thanks,
> Jeremy
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/databases/postgresql/Makefile,v
> retrieving revision 1.314
> diff -u -p -u -p -r1.314 Makefile
> --- Makefile 23 Nov 2025 03:05:13 -0000 1.314
> +++ Makefile 6 Dec 2025 02:35:03 -0000
> @@ -9,6 +9,7 @@ VERSION= 18.1
> PREV_MAJOR= 17
> DISTNAME= postgresql-${VERSION}
> PKGNAME-main= postgresql-client-${VERSION}
> +REVISION-server=0
>
> DPB_PROPERTIES= parallel
>
> Index: pkg/README-server
> ===================================================================
> RCS file: /cvs/ports/databases/postgresql/pkg/README-server,v
> retrieving revision 1.37
> diff -u -p -u -p -r1.37 README-server
> --- pkg/README-server 1 Jun 2024 05:36:58 -0000 1.37
> +++ pkg/README-server 6 Dec 2025 02:35:03 -0000
> @@ -57,17 +57,19 @@ Restart PostgreSQL to allow these change
> Tuning for busy servers
> =======================
> The default sizes in the GENERIC kernel for SysV semaphores are not
> -large enough for PostgreSQL to use the default max_connections
> -configuration value of 100, so PostgreSQL will use a smaller than
> -default max_connections if you do not increase the limits. Adding the
> -following in /etc/sysctl.conf will be reasonable for many systems:
> +large enough for PostgreSQL. Adding the following in /etc/sysctl.conf
> +should allow PostgreSQL to start:
>
> kern.seminfo.semmni=256
> kern.seminfo.semmns=2048
>
> +While you can start PostgreSQL with smaller limits, it's probably
> +not wise unless you are very resource constrained.
> +
> You may also want to tune the max_connections value in the
> postgresql.conf file to increase the number of connections to the
> -backend.
> +backend. However, for busy servers with many connections, these
> +limits may need to be increased further.
>
> By default, the _postgresql user, and so the postmaster and backend
> processes run in the login(1) class of "postgresql". On a busy server,
> @@ -77,10 +79,6 @@ more memory, etc.
>
> The capability database file is located at /etc/login.conf.d/postgresql
>
> -For more than about 250 connections, these numbers should be
> -increased. Please report any changes and experiences to the package
> -maintainers so that we can update this file for future versions.
> -
> Upgrade Howto (for a major upgrade)
> ===================================
> If you didn't install PostgreSQL by following this README,
Update PostgreSQL README regarding Sys V semaphores