pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: chenhj <chjischj@163.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: 32 bit libpq fail to connecting when set a very large "connect_timeout" value
Date: Mon, 20 Oct 2014 09:53:49 -0400
Message-ID: <3051.1413813229@sss.pgh.pa.us> (raw)
In-Reply-To: <75f4618f.c0f7.1492c250468.Coremail.chjischj@163.com>
References: <75f4618f.c0f7.1492c250468.Coremail.chjischj@163.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

chenhj <chjischj@163.com> writes:
> [chenhj@node2 ~]$ export PGCONNECT_TIMEOUT=2147483647

That's a pretty darn silly setting, wouldn't you agree?

> finish_time = time(NULL) + timeout;
> if(finish_time < ((time_t) 0))
> {
>    finish_time = ((time_t) -1);
> }

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 ...
unless time_t is redefined as unsigned 32-bit, in which case the test
becomes useless.

It might be possible to develop a test for overflow that would work
regardless of the width or signedness of time_t, but ISTM the work would
be vastly out of proportion to the benefit.  And you'd still not have
dealt with PGCONNECT_TIMEOUT > 2^31, which arguably is another "bug"
case here.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)  latest in thread

Message-ID: <3051.1413813229@sss.pgh.pa.us>
Permalink:  ../3051.1413813229@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3051.1413813229@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, chjischj@163.com
  Subject: Re: 32 bit libpq fail to connecting when set a very large "connect_timeout" value
  In-Reply-To: <3051.1413813229@sss.pgh.pa.us>
  References: <75f4618f.c0f7.1492c250468.Coremail.chjischj@163.com> <3051.1413813229@sss.pgh.pa.us>

* 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