From: | daveg <daveg(at)sonic(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: FATAL: lock AccessShareLock on object 0/1260/0 is already held |
Date: | 2011-09-07 20:22:00 |
Message-ID: | 20110907202159.GM24583@sonic.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Sep 07, 2011 at 10:20:24AM -0400, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > After spending some time staring at the code, I do have one idea as to
> > what might be going on here. When a backend is terminated,
> > ShutdownPostgres() calls AbortOutOfAnyTransaction() and then
> > LockReleaseAll(USER_LOCKMETHOD, true). The second call releases all
> > user locks, and the first one (or so we suppose) releases all normal
> > locks as part of aborting the transaction. But what if there's no
> > transaction in progress? In that case, AbortOutOfAnyTransaction()
> > won't do anything - which is fine as far as transaction-level locks
> > go, because we shouldn't be holding any of those anyway if there's no
> > transaction in progress. However, if we hold a session-level lock at
> > that point, then we'd orphan it. We don't make much use of session
> > locks. As far as I can see, they are used by (1) VACUUM, (2) CREATE
> > INDEX CONCURRENTLY, (3) ALTER DATABASE .. SET TABLESPACE, and (4) on
> > standby servers, redo of DROP DATABASE actions. Any chance one of
> > those died or was killed off around the time this happened?
>
> I don't believe this theory at all, because if that were the issue,
> we'd have heard about it long since. The correct theory has to involve
> a very-little-used triggering condition. At the moment I'm wondering
> about advisory (userspace) locks ... Dave, do your apps use any of those?
Yes, we make extensive use of advisory locks. That was my thought too when
Robert mentioned session level locks.
I'm happy to add any additional instrumentation, but my client would be
happier to actually run it if there was a way to recover from this without
an unplanned outage. Is there something I can do when the patch detects the
problem to be able to continue without a restart? Is is save to just reset
the proclock queue? I don't think they would mind leaking locks, for instance,
and a later planned restart to clear it up as much as they mind unscheduled
downtime.
Thank
-dg
--
David Gould daveg(at)sonic(dot)net 510 536 1443 510 282 0869
If simplicity worked, the world would be overrun with insects.
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-09-07 20:28:41 | Re: FATAL: lock AccessShareLock on object 0/1260/0 is already held |
Previous Message | Tom Lane | 2011-09-07 20:15:23 | Re: [PATCH] Log crashed backend's query (activity string) |