Skip site navigation (1) Skip section navigation (2)

Re: Deadlock? idle in transaction

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Deadlock? idle in transaction
Date: 2001-10-12 18:29:08
Message-ID: Pine.BSF.4.21.0110121124470.97475-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Fri, 12 Oct 2001, Michael Meskes wrote:

> On Thu, Oct 11, 2001 at 01:09:25PM -0700, Stephan Szabo wrote:
> > Well, it'd be likely to get in this state if the first transaction grabbed
> > any write locks and then sat on them without committing or doing any more
> > commands, since the vacuum would wait on that and the rest of the
> > transactions will probably wait on the vacuum.  Is that a possible
> > situation?
> 
> Maybe. The first transaction should not sit on any lock, but I have to dig
> through the sources to be sure it really does not. Also I wonder if this
> could happen through normal operation:
> 
> Task 1:
> 
> begin
> acquire lock in table A
> acquire lock in table B
> commit
> 
> Task 2 (vacuum):
> 
> lock table B
> lock table A
> 
> Could this force the situation too?

Do you mean like task1 has gotten the A lock, and then task 2 gets the B
and then task1 tries to get B and task2 tries to get A?  I *think*
(without ever looking at the code, and going on messages from here) that
would probably kick off the deadlock alert since you're trying to grab
a lock from a process which is waiting for a lock you hold.

> If so the easy workaround would be to run vacuum when there is no other
> process accessing the DB.

Well, fortunately it sounds like in 7.2 we'll have much less of this in
the first place since the normal uses of vacuum will be happier with
sharing.


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-10-12 23:22:38
Subject: Re: New contrib/tsearch module for 7.2
Previous:From: Tom LaneDate: 2001-10-12 18:27:56
Subject: Re: SQL99 time zones

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group