Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPx1E-0007jn-Lh for pgsql-performance@arkaria.postgresql.org; Mon, 22 Aug 2022 02:18:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oPx1D-00067W-Cq for pgsql-performance@arkaria.postgresql.org; Mon, 22 Aug 2022 02:18:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPx1D-00067N-3K for pgsql-performance@lists.postgresql.org; Mon, 22 Aug 2022 02:18:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPx16-0005iC-C2 for pgsql-performance@lists.postgresql.org; Mon, 22 Aug 2022 02:18:22 +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 27M2IDSo105987; Sun, 21 Aug 2022 22:18:13 -0400 From: Tom Lane To: Thomas Munro cc: Andrew Dunstan , Kevin McKibbin , pgsql-performance@lists.postgresql.org Subject: Re: pgbench: could not connect to server: Resource temporarily unavailable In-reply-to: References: <3909995.1661052002@sss.pgh.pa.us> <35d221aa-3da4-f744-3965-ceca7f71f4ea@dunslane.net> <8864.1661116501@sss.pgh.pa.us> <83134bb1-3a21-059f-1cd6-4997de2652b8@dunslane.net> <33898.1661118503@sss.pgh.pa.us> <68893.1661122531@sss.pgh.pa.us> <84184.1661127637@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Mon, 22 Aug 2022 14:02:50 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <105985.1661134693.1@sss.pgh.pa.us> Date: Sun, 21 Aug 2022 22:18:13 -0400 Message-ID: <105986.1661134693@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > On Mon, Aug 22, 2022 at 12:20 PM Tom Lane wrote: >> Hmm. It'll be awhile till the 128 default disappears entirely >> though, especially if assorted BSDen use that too. Probably >> worth the trouble to document. > I could try to write a doc patch if you aren't already on it. I haven't done anything about it yet, but could do so tomorrow or so. (BTW, I just finished discovering that NetBSD has the same 128 limit. It looks like they intended to make that settable via sysctl, because it's a variable not a constant; but they haven't actually wired up the variable to sysctl yet.) > Oh, right. Looks like that was just paranoia in commit 153f4006763, > back when you got away from using the (very conservative) SOMAXCONN > macro. Looks like that was 5 on ancient systems going back to the > original sockets stuff, and later 128 was a popular number. Yeah I'd > say +1 for removing our cap. I'm pretty sure every system will > internally cap whatever value we pass in if it doesn't like it, as > POSIX explicitly says it can freely do with this "hint". Yeah. I hadn't thought to check the POSIX text, but their listen(2) page is pretty clear that implementations should *silently* reduce the value to what they can handle, not fail. Also, SUSv2 says the same thing in different words, so the requirement's been that way for a very long time. I think we could drop this ancient bit of paranoia. > ... Hmm, maybe we could add a hint to the error, > though? libpq doesn't really have a notion of hints --- perhaps we ought to fix that sometime. But this doesn't seem like a very exciting place to start, given the paucity of prior complaints. (And anyway people using other client libraries wouldn't be helped.) I think some documentation in the "Managing Kernel Resources" section should be plenty for this. regards, tom lane