COPY: leaked lock on connection drop

Поиск
Список
Период
Сортировка
От Maciek Sakrejda
Тема COPY: leaked lock on connection drop
Дата
Msg-id BANLkTimRR-zyjCiQ_MzTQLETCe3zLGLixQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-jdbc
This is something of a degenerate error, but it's worth documenting on
the list, if nothing else.

Take the following scenario:

1. JDBC user starts COPY, COPY acquires query execution lock in
QueryExecutorImpl
2. Connection dies, and writeToCopy gets an IOException; note that
query execution lock is not released
3. User catches exception; attempts to use the connection again (e.g.,
to issue a ROLLBACK)
4. The driver waits indefinitely on the query execution lock

I have not confirmed this, but the query execution lock management
that was put in for COPY does not seem to account for exception
handling in the QueryExecutorImpl.

As far as I can see, this is never a problem in normal operation--only
when the connection dies. A potential workaround is to use
getSQLState() to check the type of error, and only attempt to use the
connection if it's still live.

The proper fix would be to manage locking and unlocking more carefully
with respect to exception handling.

---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception
Следующее
От: Emi Lu
Дата:
Сообщение: Re: "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception