Re: Deadlock problem - Mailing list pgsql-jdbc

From Andrew Sullivan
Subject Re: Deadlock problem
Date
Msg-id 20051118180347.GA29354@phlogiston.dyndns.org
Whole thread Raw
In response to Deadlock problem  ("Vit Timchishin" <tivv@gtech-ua.com>)
Responses Re: Deadlock problem  (Kris Jurka <books@ejurka.com>)
List 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@crankycanuck.ca
"The year's penultimate month" is not in truth a good way of saying
November.
        --H.W. Fowler

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Again the JSCreator and Metadata issues
Next
From: Kris Jurka
Date:
Subject: Re: Deadlock problem