Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: "Dorochevsky,Michel" <michel(dot)dorochevsky(at)softcon(dot)de>, pgsql-bugs(at)postgresql(dot)org, Dave Page <dpage(at)postgresql(dot)org>
Subject: Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect
Date: 2007-04-23 21:34:34
Message-ID: 13773.1177364074@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches

Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> Tom Lane wrote:
>> Hmm. I was just noticing this comment in PostPrepare_Locks:
>>
>> * We do this separately because we may have multiple locallock entries
>> * pointing to the same proclock, and we daren't end up with any dangling
>> * pointers.
>>
>> I'm not clear at the moment on why such a state would exist, but could
>> it be related?

> That caught my eye as well. I'm not sure what the other alternative
> would be, that might leave dangling pointers. The comment seems to be
> copy-pasted from LockReleaseAll.

I remembered what's going on there: we have a locallock entry for each
locktag + lockmode, so if you lock the same object with more than one
mode, there will be multiple locallock entries pointing to the same lock
(and proclock). The comment is worrying about what'd happen if we
deleted shared and local entries in parallel and then errored out
partway through that.

It doesn't appear possible for there to be multiple locallock entries
for the same locktag + lockmode, unless the hashtable code is completely
broken, and I imagine we'd have noticed that before now. I also spent
some time wondering if the 2PC code could mistakenly execute the same
2PC record twice, but that didn't look plausible either. Tis confusing.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-04-23 21:44:34 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect
Previous Message Tom Lane 2007-04-23 21:26:48 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-04-23 21:38:19 Re: Improving deadlock error messages
Previous Message Tom Lane 2007-04-23 21:26:48 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-04-23 21:44:34 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect
Previous Message Tom Lane 2007-04-23 21:26:48 Re: BUG #3245: PANIC: failed to re-find shared loc k o b j ect