dbTalk Databases Forums  

[BUGS] BUG #2569: statement_timeout bug on Windows

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2569: statement_timeout bug on Windows in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] BUG #2569: statement_timeout bug on Windows - 08-09-2006 , 01:11 AM







The following bug has been logged online:

Bug reference: 2569
Logged by: James
Email address: im-james (AT) hotmail (DOT) com
PostgreSQL version: 8.1.4
Operating system: Windows 200 Pro SP4
Description: statement_timeout bug on Windows
Details:

I'm using the latest version of postgresql (8.1.4) for Windows and I have a
problem with 'statement_timeout'.

Normally statement_timeout should "Abort any statement that takes over the
specified number of milliseconds". However on my pc, instead of milliseconds
it is tenth of seconds. For example: statement_timeout=30 actually means
'wait 3 seconds and abort' instead of wait 30 milliseconds.

I've tested this on the same version of postgresql on Linux and it works
correctly, as stated on the docs.

What do I do to find get this strange result? I do this.

set statement_timeout=30
show statement_timeout
VACUUM ANALYSE

The last statement is aborted after 3 seconds.


set statement_timeout=6
show statement_timeout
VACUUM ANALYSE

The last statement is aborted after 600 milliseconds.



Is this a bug (as I think) or could it be a misconfiguration of my OS, or of
postgresql?

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] BUG #2569: statement_timeout bug on Windows - 08-09-2006 , 01:03 PM







--ELM1155146338-28402-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"


I have a big "Oops" for this item. Seems in 8.0, we used the Win32 call
SetWaitableTimer(), which takes its timeout in 100 nanosecond intervals.
This was changed to use WaitForSingleObjectEx() in 8.1, but not
properly. The 8.0 code works fine.

The attached patch will fix the problem, and will be in 8.1.X. Sorry.

This affects all Win32 setitimer() calls in the backend, but the bug is
only related to micro-seconds, not full seconds. Because deadlock timer
is 1000ms, I don't think that is effected, but the stat file writer
timeout is 500ms, so that could be doing a 50sec timeout instead without
this patch.

---------------------------------------------------------------------------

James wrote:
Quote:
The following bug has been logged online:

Bug reference: 2569
Logged by: James
Email address: im-james (AT) hotmail (DOT) com
PostgreSQL version: 8.1.4
Operating system: Windows 200 Pro SP4
Description: statement_timeout bug on Windows
Details:

I'm using the latest version of postgresql (8.1.4) for Windows and I have a
problem with 'statement_timeout'.

Normally statement_timeout should "Abort any statement that takes over the
specified number of milliseconds". However on my pc, instead of milliseconds
it is tenth of seconds. For example: statement_timeout=30 actually means
'wait 3 seconds and abort' instead of wait 30 milliseconds.

I've tested this on the same version of postgresql on Linux and it works
correctly, as stated on the docs.

What do I do to find get this strange result? I do this.

set statement_timeout=30
show statement_timeout
VACUUM ANALYSE

The last statement is aborted after 3 seconds.


set statement_timeout=6
show statement_timeout
VACUUM ANALYSE

The last statement is aborted after 600 milliseconds.



Is this a bug (as I think) or could it be a misconfiguration of my OS, or of
postgresql?

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq
--
Bruce Momjian bruce (AT) momjian (DOT) us
EnterpriseDB http://www.enterprisedb.com

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

--ELM1155146338-28402-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/rtmp/diff"

Index: src/backend/port/win32/timer.c
================================================== =================
RCS file: /cvsroot/pgsql/src/backend/port/win32/timer.c,v
retrieving revision 1.9
diff -c -c -r1.9 timer.c
*** src/backend/port/win32/timer.c 9 Aug 2006 17:33:52 -0000 1.9
--- src/backend/port/win32/timer.c 9 Aug 2006 17:34:11 -0000
***************
*** 56,62 ****
timerCommArea.value.it_value.tv_usec == 0)
waittime = INFINITE; /* Cancel the interrupt */
else
! waittime = timerCommArea.value.it_value.tv_usec / 10 + timerCommArea.value.it_value.tv_sec * 1000;
ResetEvent(timerCommArea.event);
LeaveCriticalSection(&timerCommArea.crit_sec);
}
--- 56,63 ----
timerCommArea.value.it_value.tv_usec == 0)
waittime = INFINITE; /* Cancel the interrupt */
else
! /* WaitForSingleObjectEx() uses milliseconds */
! waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
ResetEvent(timerCommArea.event);
LeaveCriticalSection(&timerCommArea.crit_sec);
}

--ELM1155146338-28402-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--ELM1155146338-28402-0_--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.