Thread: executeUpdate() deadlock

executeUpdate() deadlock

From
Fischer Krisztián
Date:
Hi!

It seems, this isn't my day. I made a mistake in my program, and a new
bug (?) cropped up. Once again, the JDBC API is not clear about it. So i
thought i ask here the professionals.:)

The situation is as follows:

There are 2 connections (A) and (B).
(A) begins a transaction, and executes some selects, updates, etc... on
the table (T).
(A) closes all results and statements. (But doesn't commit!)
(B) tries to drop the table (T) before (A) was committed/rolled back or
and/or closed.

The current jdbc driver stops the thread execution in the
executeUpdate() method which tries to drop the table. I guess it waits
for (A) to get closed/committed/rolled back.

Is this the correct way or should it throw an SQLException?
I'm confused about it. If somebody knows the answer, please let me
known. Thank you!

Chris

Environment:
PostgreSQL 7.4.1 (on a debian Linux with kernel 2.4.20)
JDBC Driver: fresh CVS version (from gborg)

--
Fischer Krisztián <fischer@borganization.com>
Tel: (+36)70/3843835, (+36)1/3360547
Borganization Kft.


Re: executeUpdate() deadlock

From
"Waldomiro"
Date:
I've done this test on a psql program, so the second session waited up to
the first session be committed.

Postgres doesn't throw an exception because he manages the concurrency.


wmiro.


----- Original Message -----
From: "Fischer Krisztián" <fischer@borganization.com>
To: "pgsql-jdbc" <pgsql-jdbc@postgresql.org>
Sent: Monday, January 26, 2004 10:14 AM
Subject: [JDBC] executeUpdate() deadlock


Hi!

It seems, this isn't my day. I made a mistake in my program, and a new
bug (?) cropped up. Once again, the JDBC API is not clear about it. So i
thought i ask here the professionals.:)

The situation is as follows:

There are 2 connections (A) and (B).
(A) begins a transaction, and executes some selects, updates, etc... on
the table (T).
(A) closes all results and statements. (But doesn't commit!)
(B) tries to drop the table (T) before (A) was committed/rolled back or
and/or closed.

The current jdbc driver stops the thread execution in the
executeUpdate() method which tries to drop the table. I guess it waits
for (A) to get closed/committed/rolled back.

Is this the correct way or should it throw an SQLException?
I'm confused about it. If somebody knows the answer, please let me
known. Thank you!

Chris

Environment:
PostgreSQL 7.4.1 (on a debian Linux with kernel 2.4.20)
JDBC Driver: fresh CVS version (from gborg)

--
Fischer Krisztián <fischer@borganization.com>
Tel: (+36)70/3843835, (+36)1/3360547
Borganization Kft.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Re: executeUpdate() deadlock

From
Fischer Krisztián
Date:
I see... I have to handle such cases by myself (for example to detect
software problems).

Thanks wmiro!

Waldomiro wrote:
> I've done this test on a psql program, so the second session waited up to
> the first session be committed.
> Postgres doesn't throw an exception because he manages the concurrency.
> wmiro.

--
Fischer Krisztián <fischer@borganization.com>
Tel: (+36)70/3843835, (+36)1/3360547
Borganization Kft.