Re: libpq connection timeout mismanagement - Mailing list pgsql-hackers

From Tom Lane
Subject Re: libpq connection timeout mismanagement
Date
Msg-id 20525.1534180589@sss.pgh.pa.us
Whole thread Raw
In response to Re: libpq connection timeout mismanagement  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: libpq connection timeout mismanagement
List pgsql-hackers
Fabien COELHO <coelho@cri.ensmp.fr> 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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Temporary tables prevent autovacuum, leading to XID wraparound
Next
From: Robert Haas
Date:
Subject: Re: libpq connection timeout mismanagement