Re: [PATCH] Allow breaking out of hung connection attempts

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>

From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Shigeru HANADA <shigeru.hanada@gmail.com>
Cc: Ryan Kelly <rpkelly22@gmail.com>, Alvaro Herrera <alvherre@commandprompt.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-07-12T13:28:41Z
Lists: pgsql-hackers
On 09.07.2012 11:35, Shigeru HANADA wrote:
> Once the issues above are fixed, IMO this patch can be marked as "Ready
> for committer".

Thanks. The docs on async connections says:

"The connect_timeout connection parameter is ignored when using 
PQconnectPoll; it is the application's responsibility to decide whether 
an excessive amount of time has elapsed."

I think we should recommend using PQconnectTimeout(), similar to what 
you did in psql, in all client applications that use the non-blocking 
connection API. Perhaps something like:

"The connect_timeout connection parameter is ignored when using 
PQconnectPoll; it is the application's responsibility to decide whether 
an excessive amount of time has elapsed. It is recommended to use the 
PQconnectTimeout() to get value of the parameter, and use that as the 
timeout in the application. That way the user gets the same timeout 
behavior, regardless of whether the application uses PQconnectPoll or 
the nonblocking connection API."

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com