How to handle waitingForLock in LockWaitCancel() - Mailing list pgsql-hackers

From Hiroshi Inoue
Subject How to handle waitingForLock in LockWaitCancel()
Date
Msg-id 3AA3026C.7623B17F@tpf.co.jp
Whole thread Raw
Responses Re: How to handle waitingForLock in LockWaitCancel()
List pgsql-hackers
Hi,

I sometimes encountered SEGV errors in my test case
when I canceled the execution.
Probably it's due to the almost simultaneous arrival
of multiple signals and the following patch seems to
fix the bug. However I'm afraid that the change should
cause another bug.

Comments ?

Regards,
Hiroshi Inoue


Index: proc.c
===================================================================
RCS file:
/home/projects/pgsql/cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v
retrieving revision 1.98
diff -c -c -r1.98 proc.c
*** proc.c      2001/01/26 18:23:12     1.98
--- proc.c      2001/03/05 02:28:09
***************
*** 327,334 ****       if (!waitingForLock)               return false;

-       waitingForLock = false;
-       /* Turn off the deadlock timer, if it's still running (see
ProcSleep) */ #ifndef __BEOS__       {
--- 327,332 ----
***************
*** 345,350 ****
--- 343,349 ----
       /* Unlink myself from the wait queue, if on it (might not be
anymore!) *
/       LockLockTable();
+       waitingForLock = false;       if (MyProc->links.next != INVALID_OFFSET)
RemoveFromWaitQueue(MyProc);      UnlockLockTable();
 


pgsql-hackers by date:

Previous
From: "Patrick Dunford"
Date:
Subject: Access 97 & PostgreSQL ODBC Driver Problems
Next
From: Tom Lane
Date:
Subject: Re: How to handle waitingForLock in LockWaitCancel()