pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Im <im-james@hotmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: SQL query never ends
Date: Wed, 09 Aug 2006 16:24:51 +0000
Message-ID: <BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl> (raw)

>Is this running in a multi-threaded environment?
Yes it is.


>If so, are there measures in place to ensure that only one thread uses
the connection at a time?
I'm using a thread pool so normally one thread takes one connection out
of the pool and operates on it.
From what I see the borrowObject() appears to contains a synchronized
block to that 2 threads could
not take a same connection at the same time. However, just to be sure, I
added synchronization to the
methods of the GenericObjectPool (you can see the -locked below).
If it ever was a synchronization problem I think that now there is none.

>It would also be useful if you could do a thread dump while it's hanging
>and send a stack trace of the affected thread.

Here it is. This time, the sql statement that blocked is "select true" which 
I do before
returning the connection from the pool to make sure that the connection is 
ok.
None of the other threads where in the org.postgresql package when I did the 
thread dump.

"Thread-11" prio=6 tid=0x25499dd0 nid=0x868 runnable 
[0x2801f000..0x2801fa64]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
- locked <0x115fcf88> (a java.io.BufferedInputStream)
at org.postgresql.core.PGStream.ReceiveIntegerR(PGStream.java:275)
at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1171)
at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
- locked <0x115f8210> (a org.postgresql.core.v3.QueryExecutorImpl)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:340)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:239)
at services.jdbc.StatementWrapper.executeQuery(Unknown Source)
at services.jdbc.ConnectionWrapper.validateObject(Unknown Source)
at services.pool.GenericObjectPool.testObject(Unknown Source)
at services.pool.GenericObjectPool.borrowObject(Unknown Source)
- locked <0x115875c0> (a services.pool.GenericObjectPool)
at services.jdbc.DataSource.getConnection(Unknown Source)
at services.jdbc.GlobalJdbc.getConnection(Unknown Source)
at common.BuildTreeListingCommon.rebuildListing(Unknown Source)
at common.BuildTreeListingCommon.rebuildListing(Unknown Source)
at client.BuildTreeListing.getPage(Unknown Source)
at common.WebDispatcher.start(Unknown Source)
at java.lang.Thread.run(Thread.java:595)

_________________________________________________________________
Download din yndlingsmusik på MSN Music:  http://www.msn.dk/music  - det er 
nemt og billigt




view thread (19+ messages)  latest in thread

Message-ID: <BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl>
Permalink:  ../BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl/
Also on:    postgresql.org/message-id/BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: im-james@hotmail.com
  Subject: Re: SQL query never ends
  In-Reply-To: <BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl>
  References: <BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox