Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Denis A Ustimenko <denis(at)oldham(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date: 2002-10-15 04:22:33
Message-ID: 200210150422.g9F4MXv20336@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Denis A Ustimenko wrote:
> >> Beware of almost 1 second posiible error. For example: connect_timeout == 1,
> >> we start at 0.999999 then finish_time == 1. If CPU is quite busy we will
> >> do only one iteration. I don't know is it enough to make connection?
> >> True timeout in this case == 0.000001
>
> > Good question. What is going to happen is that select() is going to be
> > passed tv_sec = 1, and it is going to sleep for one second. Now, if
> > select is interrupted, another time() call is going to be made.
>
> There is a very simple answer to this, which I think I suggested to Joe
> originally, but it's not in the code now: the initial calculation of
> finish_time = now() + timeout must add one. This ensures that any
> roundoff error is in the conservative direction of timing out later,
> rather than sooner.

Yes, I saw that and will try to add it back into the code.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Kalchev 2002-10-15 08:04:07 DROP USER weirdness in 7.2.1
Previous Message Larry Rosenman 2002-10-15 04:06:00 PG_DUMP and Adding columns/Types