Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpGSM-0002sr-4p for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Aug 2018 17:16:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpGSK-0006lc-3y for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Aug 2018 17:16:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpGSJ-0006lU-LU for pgsql-hackers@lists.postgresql.org; Mon, 13 Aug 2018 17:16:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpGSH-0008Vw-58 for pgsql-hackers@lists.postgresql.org; Mon, 13 Aug 2018 17:16:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7DHGUGb020526; Mon, 13 Aug 2018 13:16:30 -0400 From: Tom Lane To: Fabien COELHO cc: PostgreSQL Developers Subject: Re: libpq connection timeout mismanagement In-reply-to: References: <5735.1533828184@sss.pgh.pa.us> Comments: In-reply-to Fabien COELHO message dated "Sat, 11 Aug 2018 16:42:16 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20524.1534180589.1@sss.pgh.pa.us> Date: Mon, 13 Aug 2018 13:16:29 -0400 Message-ID: <20525.1534180589@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Fabien COELHO writes: > Patch does not "git apply", but is ok with "patch -p1". Compiles. Yeah, as far as I can tell, "git apply" is very intolerant. > The code suggests that timeout is always 2 or more > if (timeout < 2) timeout = 2; > but doc says "It is not recommended to use a timeout of less than 2 > seconds", which is inconsistent. It should read "Timeout is always set to > at least 2 whatever the user asks.". Agreed, changed the docs to clarify this. > connect_timeout=2.9 is accepted and considered as meaning 2. > connect_timeout=-10 or connect_timeout=two are also accepted and mean > forever. Probably thanks to "atoi". Right. As before, I'm not excited about rejecting trailing junk, considering we never did before. It is kind of bogus that the resolution of the timeout is only 1 second though --- maybe in 2002 that was fine, but today it seems strange. I'm tempted to change the parameter to be floating point (parse with atof, say) and allow millisecond precision. Then we'd not really need to have the restriction about minimum delay. That's a task for a different patch though. In the meantime, pushed this one --- thanks for reviewing! regards, tom lane