Re: [PATCHES] BUG #2569: statement_timeout bug on Windows

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, James <im-james(at)hotmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCHES] BUG #2569: statement_timeout bug on Windows
Date: 2006-08-09 20:41:26
Message-ID: 200608092041.k79KfQi18848@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> ! /* WaitForSingleObjectEx() uses milliseconds */
> > ! waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
>
> Seems like this probably ought to round up not down:
>
> waittime = (timerCommArea.value.it_value.tv_usec + 999) / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
>
> Otherwise, an attempt to wait for 100 usec would convert to waittime 0,
> which seems like a bad thing. In general the semantics of timed waits
> are always supposed to be "you wait at least this long".

I thought about that, but because statement_timeout is in millis, and
not micros, we can't have a value that gets rounded down. I am
thinking a cleaner solution is to check for secs and if that is 0 and
microsecs < 1000, you set millis = 1.

Patch attached and applied to head and 8.1.X.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 967 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-09 20:50:44 Re: [PATCHES] BUG #2569: statement_timeout bug on Windows
Previous Message Tom Lane 2006-08-09 20:10:38 Re: [PATCHES] BUG #2569: statement_timeout bug on Windows

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-08-09 20:42:40 Re: Buildfarm failure on ecpg/test/pgtypeslib
Previous Message Bruce Momjian 2006-08-09 20:34:47 Re: WIN32 Build?

Browse pgsql-patches by date

  From Date Subject
Next Message Andreas Pflug 2006-08-09 20:46:41 Re: remote query debugging was: Plugins redux
Previous Message Tom Lane 2006-08-09 20:17:02 Re: Maintaining cluster order on insert