Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thzAR-009bKq-15 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 22:55:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1thzAO-001bBx-Fb for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 22:55:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thzAO-001bBn-5e for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 22:55:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1thzAN-000Ise-03 for pgsql-hackers@postgresql.org; Tue, 11 Feb 2025 22:55:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 51BMtdku3226912; Tue, 11 Feb 2025 17:55:39 -0500 From: Tom Lane To: Andres Freund cc: Tomas Vondra , Jelte Fennema-Nio , PostgreSQL-development Subject: Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup In-reply-to: References: <3203865.1739301613@sss.pgh.pa.us> <94798ef1-0f13-416a-983a-88447e434a7f@vondra.me> <7u7dbn6s2i6bf3hjzkbqaexj2bpoblqxwbkffbetl4rjv6dcom@s2uickjc5z53> <3216369.1739308717@sss.pgh.pa.us> Comments: In-reply-to Andres Freund message dated "Tue, 11 Feb 2025 17:27:09 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3226910.1739314539.1@sss.pgh.pa.us> Date: Tue, 11 Feb 2025 17:55:39 -0500 Message-ID: <3226911.1739314539@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > In the current version of the AIO patchset, the creation of those io_uring > instances does happen as part of an shmem init callback, as the io uring > creation also sets up queues visible in shmem. Hmm. > So the issue would actually be that we're currently doing set_max_safe_fds() > too late, not too early :/ Well, we'd rather set_max_safe_fds happen after semaphore creation, so that it doesn't have to be explicitly aware of whether semaphores consume FDs. Could we have it be aware of how many FDs *will be* needed for io_uring, but postpone creation of those until after we jack up RLIMIT_NOFILE? I guess the other way would be to have two rounds of RLIMIT_NOFILE adjustment, before and after shmem creation. That seems ugly but shouldn't be very time-consuming. regards, tom lane