Deadlock problem - Mailing list pgsql-hackers

From Vatsal Avasthi
Subject Deadlock problem
Date
Msg-id 1067524543.14133.11.camel@M3-113824
Whole thread Raw
Responses Re: Deadlock problem
Re: Deadlock problem
List pgsql-hackers
Hi, <br />   I am facing a strange problem and thats bugging me for a long time, <br /> I am using postgres version
7.2.1.<br /><br /> I have written an application in C which  tries to drop a trigger and simultaneously read from a
tablethats has data related to that trigger. <br /> the whole database comes into a deadlock stage where drop() keeps
waitingon one hand and select() keeps waiting on other hand. <br /><br /> i have the stack trace of the processes that
areperforming the operation <br /><br /> For Drop: <br /> process doing drop trigger <br /> (gdb) where <br /> #0 
0x420e8a42in semop () from /lib/i686/libc.so.6 <br /> #1  0x0810f028 in IpcSemaphoreLock () <br /> #2  0x081132c0 in
ProcSleep() <br /> #3  0x081124e5 in WaitOnLock () <br /> #4  0x08112289 in LockAcquire () <br /> #5  0x081116d8 in
LockRelation() <br /> #6  0x0807407b in relation_openr () <br /> #7  0x08074195 in heap_openr () <br /> #8  0x080bed34
inDropTrigger () <br /> #9  0x081176c7 in pg_exec_query_string () <br /> #10 0x0811876a in PostgresMain () <br /> #11
0x080fde2ain DoBackend () <br /> #12 0x080fd77d in BackendStartup () <br /> #13 0x080fc8c1 in ServerLoop () <br /> #14
0x080fc2dbin PostmasterMain () <br /> #15 0x080da152 in main () <br /> #16 0x42017499 in __libc_start_main () from
/lib/i686/libc.so.6<br /> (gdb) <br /><br /> For Select() <br /> process's doing select <br /> (gdb) where <br /> #0 
0x420e8a42in semop () from /lib/i686/libc.so.6 <br /> #1  0x0810f028 in IpcSemaphoreLock () <br /> #2  0x081132c0 in
ProcSleep() <br /> #3  0x081124e5 in WaitOnLock () <br /> #4  0x08112289 in LockAcquire () <br /> #5  0x081116d8 in
LockRelation() <br /> #6  0x0807407b in relation_openr () <br /> #7  0x08074195 in heap_openr () <br /> #8  0x0810905a
infireRIRrules () <br /> #9  0x08108e21 in ApplyRetrieveRule () <br /> #10 0x08109134 in fireRIRrules () <br /> #11
0x08108ff9in fireRIRrules () <br /> #12 0x08108e21 in ApplyRetrieveRule () <br /> #13 0x08109134 in fireRIRrules () <br
/>#14 0x08108e21 in ApplyRetrieveRule () <br /> #15 0x08109134 in fireRIRrules () <br /> #16 0x081095ec in QueryRewrite
()<br /> #17 0x081173c9 in pg_analyze_and_rewrite () <br /> #18 0x08117635 in pg_exec_query_string () <br /> #19
0x0811876ain PostgresMain () <br /> #20 0x080fde2a in DoBackend () <br /> #21 0x080fd77d in BackendStartup () <br />
#220x080fc8c1 in ServerLoop () <br /> ---Type <return> to continue, or q <return> to quit--- <br /> #23
0x080fc2dbin PostmasterMain () <br /> #24 0x080da152 in main () <br /> #25 0x42017499 in __libc_start_main () from
/lib/i686/libc.so.6<br /> (gdb) <br /><br /> Looks like both try to have a lock and that leads to a deadlock situation.
<br/> internally does drop  trigger and select try to lock a particluar table? <br /> how can i get details whats
happeninginternally in postgres for these operations? <br /><br /><br /><br /> I can provide more info if needed, hope
thestack traces are helpful. <br /> Kindly help me, this problem is causinig lot of problem for me. <br /><br /> Thanks
inadvance <br /> regards <br /> vatsal <table cellpadding="0" cellspacing="0" width="100%"><tr><td><font
size="2"><b>_</b></font></td></tr></table><table><tr><tdbgcolor="#ffffff"><font
color="#000000"><pre>**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individualor entity to which it is addressed. You are
notifiedthat any use, copying 
 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************
</pre></font></td></tr></table>

pgsql-hackers by date:

Previous
From: Daniel Migowski
Date:
Subject: CREATE TYPE for case insensitive text and varchar
Next
From: "scott.marlowe"
Date:
Subject: Re: Deadlock problem