Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup
Date
Msg-id 849933.1739814039@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2025-02-12 22:52:52 +0100, Jelte Fennema-Nio wrote:
>> +                /*
>> +                 * Bump the soft limit to the hard limit to not run into low
>> +                 * file limits.
>> +                 */
>> +                rlim.rlim_cur = rlim.rlim_max;
>> +                if (setrlimit(RLIMIT_NOFILE, &rlim) == -1)
>> +                    pg_fatal("setrlimit failed: %m");
>> +
>> if (rlim.rlim_cur < nclients + 3)

> Why not do this only in the if (rlim.rlim_cur < nclients + 3) case?

+1, otherwise you're introducing a potential failure mode for nothing.
It'd take a couple extra lines to deal with the scenario where
rlim_max is still too small, but that seems fine.

> Other than this I think we should just apply this.

Agreed on the pgbench change.  I don't have an opinion yet on the
server changes.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: psql: Add tab completion for ALTER USER RESET
Next
From: Nathan Bossart
Date:
Subject: Re: Improve CRC32C performance on SSE4.2