Re: Deadlock problem

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Deadlock problem
Date: 2005-11-18 18:03:47
Message-ID: 20051118180347.GA29354@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, Nov 18, 2005 at 12:09:16PM +0200, Vit Timchishin wrote:

> I suppose that this means that I've first used connection object
> from one thread and this thread pid (linux x86-64) took exclusive
> lock and now another thread tries to use same connection and is
> going into lock. Am I correct? If so, why this exclusive locks are
> help while there no other queries executed? Or does this mean I
> can't use same connection object from different threads?

The answer to question (1) is "presumably", and the answer to
question (2) is "there is too another query being executed". There
_must_ be a query being executed by the back end (whatever your
application thinks), because that's what's got the exlusive lock.
Moreover, an exclusive lock is pretty strong -- presumably a row is
being modified. But I suspect that, whatever you're doing, you don't
really want to be using the same connection object from different
threads (unless you mean, serially -- like a connection pool which
hands out "the same connection" multiple times). If this connection
is being actively used by more than one thread concurrently, things
are going to break in really surprising ways.

A
--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
"The year's penultimate month" is not in truth a good way of saying
November.
--H.W. Fowler

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-11-18 18:25:51 Re: Problem when upgrade PostgreSQL 7.3.3 to PostgreSQL 8.0.3
Previous Message Vit Timchishin 2005-11-18 10:09:16 Deadlock problem