From: chenhj <chjischj@163.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: 32 bit libpq fail to connecting when set a very large "connect_timeout" value
Date: Wed, 22 Oct 2014 00:09:04 +0800 (CST)
Message-ID: <5e02241f.e1dd.1493378083f.Coremail.chjischj@163.com> (raw)
In-Reply-To: <3051.1413813229@sss.pgh.pa.us>
References: <75f4618f.c0f7.1492c250468.Coremail.chjischj@163.com>
<3051.1413813229@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Tom
Thanks for your response!
>That's a pretty darn silly setting, wouldn't you agree?
In practice, yes.
And the manual of PG also does not say how large value can be set to "connect_timeout" , It cannot be even call it a "bug"
But sometimes it maybe useful to know the the value range of "connect_timeout".
If without this problem we can say 2~2^31,but now ...
>I don't care for this "fix" because it assumes that all current and future
>time_t's are positive. On 32-bit machines that would break in 2038 ...
Currently PG has assumed time_t's are positive, didn't it?
static int
pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time)
{
...
if (end_time == ((time_t) -1))
timeout_ms = -1;
else
{
time_tnow = time(NULL);
if (end_time > now)
...
}
>And you'd still not have dealt with PGCONNECT_TIMEOUT > 2^31, which arguably is another "bug"
>case here.
In my test when PGCONNECT_TIMEOUT > 2^31, atoi() will always return 2^31.
inttimeout = atoi(conn->connect_timeout);
Best Regards
Chen Huajun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: chjischj@163.com, tgl@sss.pgh.pa.us
Subject: Re: 32 bit libpq fail to connecting when set a very large "connect_timeout" value
In-Reply-To: <5e02241f.e1dd.1493378083f.Coremail.chjischj@163.com>
References: <75f4618f.c0f7.1492c250468.Coremail.chjischj@163.com> <3051.1413813229@sss.pgh.pa.us> <5e02241f.e1dd.1493378083f.Coremail.chjischj@163.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox