Re: locking problem in jdbc driver?

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: locking problem in jdbc driver?
Дата
Msg-id 4B3BF93A.50108@postnewspapers.com.au
обсуждение исходный текст
Ответ на locking problem in jdbc driver?  (Sherif Kottapurath <sherifkm@gmail.com>)
Ответы Re: locking problem in jdbc driver?  (Sherif Kottapurath <sherifkm@gmail.com>)
Список pgsql-jdbc
On 31/12/2009 12:29 AM, Sherif Kottapurath wrote:
> I am seeing the following problem, where a thread holding a java  lock
> seems to be blocking another query. I suspect the the thread holding the
> java lock
> may be waiting for a DB lock to be freed by the second one. I am pasting the
> relevant parts of the java stack trace. All threads shown here are
> operating on
> the same table, and they are all parts of transactions involving
> multiple tables.

It looks like your threads may all be trying to use the same connection.

The PgJDBC documentation states: "If a thread attempts to use the
connection while another one is using it, it will wait until the other
thread has finished its current operation. If the operation is a regular
SQL  statement, then the operation consists of sending the statement and
retrieving any ResultSet (in full)."

The lock your thread is waiting on is a lock that controls access to the
PostgreSQL connection object so that only one thread may do work with it
at a time. If your threads are deadlocking, it's probably because one
thread is waiting for another to do work that it cannot do until the
first thread releases the connection. Perhaps you forgot to close a
statement somewhere?

> deadlock detection is set for 1 sec and no dedlocks are reported by
> postgres.

PostgreSQL will detect deadlocks where two connections in PostgreSQL are
each waiting for locks the other connection holds. You're only using one
connection, and your issue is with Java locking, so PostgreSQL knows
nothing about it.

--
Craig Ringer

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: locking problem in jdbc driver?
Следующее
От: Sherif Kottapurath
Дата:
Сообщение: Re: locking problem in jdbc driver?