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 1oPso5-0006gV-1B for pgsql-performance@arkaria.postgresql.org; Sun, 21 Aug 2022 21:48:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oPso3-00040I-07 for pgsql-performance@arkaria.postgresql.org; Sun, 21 Aug 2022 21:48:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPso2-000409-N3 for pgsql-performance@lists.postgresql.org; Sun, 21 Aug 2022 21:48:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPsnz-0000CW-AJ for pgsql-performance@lists.postgresql.org; Sun, 21 Aug 2022 21:48:29 +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 27LLmNIS033899; Sun, 21 Aug 2022 17:48:23 -0400 From: Tom Lane To: Andrew Dunstan cc: Kevin McKibbin , pgsql-performance@lists.postgresql.org Subject: Re: pgbench: could not connect to server: Resource temporarily unavailable In-reply-to: <83134bb1-3a21-059f-1cd6-4997de2652b8@dunslane.net> 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> Comments: In-reply-to Andrew Dunstan message dated "Sun, 21 Aug 2022 17:26:55 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <33897.1661118503.1@sss.pgh.pa.us> Date: Sun, 21 Aug 2022 17:48:23 -0400 Message-ID: <33898.1661118503@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > On 2022-08-21 Su 17:15, Tom Lane wrote: >> On the whole this is smelling more like a Linux kernel bug than >> anything else. > *nod* Conceivably we could work around this in libpq: on EAGAIN, just retry the failed connect(), or maybe better to close the socket and take it from the top with the same target server address. On the one hand, reporting EAGAIN certainly sounds like an invitation to do just that. On the other hand, if the failure is persistent then libpq is locked up in a tight loop --- and "Insufficient entries in the routing cache" doesn't seem like a condition that would clear immediately. It's also pretty unclear why the kernel would want to return EAGAIN instead of letting the nonblock connection path do the waiting, which is why I'm suspecting a bug rather than designed behavior. I think I'm disinclined to install such a workaround unless we get confirmation from some kernel hacker that it's operating as designed and application-level retry is intended. regards, tom lane