Re: [BUGS] Win32 deadlock detection not working for Postgres8beta1

"Magnus Hagander" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32,gmane.comp.db.postgresql.bugs,gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
>> I am just starting to test out Postgres8 beta1 and notice that the
>> deadlock detection mechanism is not working (under windows 
>XP pro with
>> service pack 1).  I am using the version of Postgres built by the
>> PGFoundry project, and have it installed as a service.
>
>> To produce the bug I simply launch 2 separate psql windows, begin a
>> transaction in each, then do staggered 'SELECT ... FOR 
>UPDATE' calls on 2
>> different rows in each of the psql windows, in reverse 
>order.  The two
>> processes will hang indefinitely.
>
>> The deadlock detection for 8beta1 seems to work fine under 
>linux btw.  I
>> have not tried this using a version of 8beta1 built using 
>cygwin, but I
>> have run versin 7.4 under cygwin before without this problem.
>
>A reasonable theory about this would be that the timer interrupt isn't
>firing.  Does "statement_timeout" work either?

Bugger. I've found the reason for this - statement_timeout was also
broken. This was broken by the change of how signals are handled on
win32. We disabled APCs completely, but APCs were still used in the
timer emulation... This patch fixes this by re-enabling APCs in the main
check loop. The APC routine used by the timer code is very simple and
will not interfer with the signal stuff (which had problems with socket
calls, as you probably recall).

//Magnus


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [email protected]
win32_timer.patch (application/octet-stream, 814 B)
Index: src/include/miscadmin.h
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/include/miscadmin.h,v
retrieving revision 1.167
diff -c -r1.167 miscadmin.h
*** src/include/miscadmin.h	29 Aug 2004 05:06:55 -0000	1.167
--- src/include/miscadmin.h	2 Sep 2004 18:17:57 -0000
***************
*** 88,94 ****
  
  #define CHECK_FOR_INTERRUPTS() \
  do { \
! 	if (WaitForSingleObject(pgwin32_signal_event,0) == WAIT_OBJECT_0) \
  		pgwin32_dispatch_queued_signals(); \
  	if (InterruptPending) \
  		ProcessInterrupts(); \
--- 88,94 ----
  
  #define CHECK_FOR_INTERRUPTS() \
  do { \
! 	if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE) == WAIT_OBJECT_0) \
  		pgwin32_dispatch_queued_signals(); \
  	if (InterruptPending) \
  		ProcessInterrupts(); \
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.