Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 35091632F2C for ; Wed, 30 Dec 2009 12:29:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55903-09 for ; Wed, 30 Dec 2009 16:29:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f176.google.com (mail-iw0-f176.google.com [209.85.223.176]) by mail.postgresql.org (Postfix) with ESMTP id 21261632D3C for ; Wed, 30 Dec 2009 12:29:46 -0400 (AST) Received: by iwn6 with SMTP id 6so7981199iwn.15 for ; Wed, 30 Dec 2009 08:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=jWQH3kuyHSdKuJSc4pqqjPz2DzDKDUtQEX4KAQrOsDo=; b=KTVatXSEse1kTSWucayNui/VmgHy6Lp1EgwCVq2nCm3otNF+NxhnQH+A9OIMIBBRry CDNrYJTHCFgSd5IKom5sHjiD2t+wDDPnHzPiIyAQ9ccnL9wTp1fpXpUzTOx8Dwh5qkWH MhVUEzsZKQjUPi5tKHvbOmGmpCJcPyYxF9Oow= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=xhYwpWPeqoCOkohDL15ftXpLLD6gSeI776jIagV5VEA9mmkED20LMZaPcN1eaBZQuy Fbhcazsf/CAO0KRm+Xxomimrh0QabAVcdzCsh0dWvcedBgIaXVYZAvXIt4mpQF6Lryeo 7s6h+nfRqwFmpyVRwhq8EWN199/ZGwGAWMheA= MIME-Version: 1.0 Received: by 10.231.123.41 with SMTP id n41mr858977ibr.46.1262190586112; Wed, 30 Dec 2009 08:29:46 -0800 (PST) Date: Wed, 30 Dec 2009 21:59:46 +0530 Message-ID: <16cfd0b20912300829s47e5b081ma318561897d8d1bf@mail.gmail.com> Subject: locking problem in jdbc driver? From: Sherif Kottapurath To: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016e647195a862ad5047bf4a544 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.109 tagged_above=-10 required=5 tests=BAYES_05=-1.11, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200912/109 X-Sequence-Number: 20190 --0016e647195a862ad5047bf4a544 Content-Type: text/plain; charset=UTF-8 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. deadlock detection is set for 1 sec and no dedlocks are reported by postgres. "http-192.168.0.22-8080-6" daemon prio=10 tid=0x083bcc00 nid=0x2fc4 waiting for monitor entry [0x8c9fd000] java.lang.Thread.State: BLOCKED (on object monitor) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:169) - waiting to lock <0x959ebed0> (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... "http-192.168.0.22-8080-3" prio=10 tid=0x8ea6e000 nid=0x2f3e runnable [0x8c9ad000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:255) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1165) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) - locked <0x959ebed0> (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) ... "http-192.168.0.22-8080-5" daemon prio=10 tid=0x0900c000 nid=0x2f53 runnable [0x8c56d000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:255) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1165) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) - locked <0x959e0800> (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... "http-192.168.0.22-8080-4" daemon prio=10 tid=0x08eae000 nid=0x2f4f runnable [0x8c5be000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:255) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1165) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) - locked <0x98004510> (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source) ... Sherif --0016e647195a862ad5047bf4a544 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I am seeing the following problem, where a thread holding a java=C2=A0 lock=
seems to be blocking another query. I suspect the the thread holding th= e 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 operatin= g on
the same table, and they are all parts of transactions involving mu= ltiple tables.
deadlock detection is set for 1 sec and no dedlocks are r= eported by postgres.

"http-192.168.0.22-8080-6" daemon prio=3D10 tid=3D0x083bcc00 = nid=3D0x2fc4 waiting for monitor entry [0x8c9fd000]
=C2=A0=C2=A0 java.la= ng.Thread.State: BLOCKED (on object monitor)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryEx= ecutorImpl.java:169)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 - waiting to lock <0x959ebed0= > (a org.postgresql.core.v3.QueryExecutorImpl)
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.AbstractJdbc2Statement.execut= e(AbstractJdbc2Statement.java:452)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abst= ractJdbc2Statement.java:351)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255)
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at com.mchange.v2.c3p0.impl.NewProxyPrepa= redStatement.executeQuery(NewProxyPreparedStatement.java:76)
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at sun.reflect.GeneratedMethodAccessor61.= invoke(Unknown Source)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at sun.reflect.DelegatingMethodA= ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.lang.reflect.Method.invoke(Method.java:= 597)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ...

"http-19= 2.168.0.22-8080-3" prio=3D10 tid=3D0x8ea6e000 nid=3D0x2f3e runnable [0= x8c9ad000]
=C2=A0=C2=A0 java.lang.Thread.State: RUNNABLE
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.so= cketRead0(Native Method)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.re= ad(SocketInputStream.java:129)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.VisibleBu= fferedInputStream.readMore(VisibleBufferedInputStream.java:135)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.VisibleBu= fferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.VisibleBu= fferedInputStream.read(VisibleBufferedInputStream.java:73)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.PGStream.= ReceiveChar(PGStream.java:255)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryE= xecutorImpl.processResults(QueryExecutorImpl.java:1165)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryE= xecutorImpl.execute(QueryExecutorImpl.java:191)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 - locked <0x959ebed0> (a o= rg.postgresql.core.v3.QueryExecutorImpl)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.execute(AbstractJdbc2Statement.java:452)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:305)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at com.mchange.v2.c3p0.impl.NewP= roxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ...

"http-192.168.0.= 22-8080-5" daemon prio=3D10 tid=3D0x0900c000 nid=3D0x2f53 runnable [0x= 8c56d000]
=C2=A0=C2=A0 java.lang.Thread.State: RUNNABLE
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.socketRead0(Na= tive Method)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.re= ad(SocketInputStream.java:129)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBuffe= redInputStream.java:135)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at o= rg.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedIn= putStream.java:104)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.VisibleBu= fferedInputStream.read(VisibleBufferedInputStream.java:73)
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.PGStream.ReceiveChar(= PGStream.java:255)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.pos= tgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:116= 5)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryE= xecutorImpl.execute(QueryExecutorImpl.java:191)
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 - locked <0x959e0800> (a org.postgresql.core.v3.Qu= eryExecutorImpl)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postg= resql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.AbstractJdbc2S= tatement.executeUpdate(AbstractJdbc2Statement.java:305)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 at com.mchange.v2.c3p0.impl.NewProxyPreparedSta= tement.executeUpdate(NewProxyPreparedStatement.java:105)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at sun.reflect.GeneratedMethodAc= cessor94.invoke(Unknown Source)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce= ssorImpl.java:25)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.lan= g.reflect.Method.invoke(Method.java:597)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ...
"http-192.168.0.22-8= 080-4" daemon prio=3D10 tid=3D0x08eae000 nid=3D0x2f4f runnable [0x8c5b= e000]
=C2=A0=C2=A0 java.lang.Thread.State: RUNNABLE
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.socketRead0(Nativ= e Method)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at java.net.SocketInputStream.re= ad(SocketInputStream.java:129)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBuffe= redInputStream.java:135)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at o= rg.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedIn= putStream.java:104)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.VisibleBu= fferedInputStream.read(VisibleBufferedInputStream.java:73)
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.PGStream.ReceiveChar(= PGStream.java:255)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.pos= tgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:116= 5)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryE= xecutorImpl.execute(QueryExecutorImpl.java:191)
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 - locked <0x98004510> (a org.postgresql.core.v3.Qu= eryExecutorImpl)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postg= resql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.Abstract= Jdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc2.AbstractJdbc2S= tatement.executeUpdate(AbstractJdbc2Statement.java:305)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 at com.mchange.v2.c3p0.impl.NewProxyPreparedSta= tement.executeUpdate(NewProxyPreparedStatement.java:105)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at sun.reflect.GeneratedMethodAc= cessor94.invoke(Unknown Source)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ...

Sherif
--0016e647195a862ad5047bf4a544--