From: | "James Im" <im-james(at)hotmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: SQL query never ends |
Date: | 2006-08-09 16:24:51 |
Message-ID: | BAY7-F13563CBBDE20B45F6C5CD96550@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
>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
From | Date | Subject | |
---|---|---|---|
Next Message | Randall Hauch | 2006-08-09 23:12:02 | Problem with JDBC and Large Objects |
Previous Message | Dave Cramer | 2006-08-09 14:10:10 | Re: SQL query never ends |