if t[i].join(); (or anything) throws an exception, then the first connection that you open will dangle. Do you see "we've got an exception" anywhere in your logs? put *all* the conn.close() in finally blocks... also, what is the point of calling ds.getConnection() two times?
Your code should be: Connection conn = null; try { conn = ds.getConnection(); // create your searcher threads and run the two for loops } finally { if (conn != null && !conn.isClosed()) conn.close(); } You need to check for null (and !isClosed() to be safe) because if there is a failure opening the connection the finally block will null out. jon On Tue, Jul 21, 2009 at 3:09 PM, .pQd <kud...@gmail.com> wrote: > > i can reproduce similar the problem with following code as at: > > http://www.copypastecode.com/7556/ > > during execution with ab -n 200000 -c 1 "http://10.14.10.12:8080/app/Ta" > [ plenty of requests one after another - to avoid additional complications > no parallel requests ] i sporadically get: > > [22:04:37.654] done > [22:04:37.654] [22:04:37.654] {http--8080-22} Closing dangling connections. > All connections must have a close() in a finally block. > [22:04:37.654] [22:04:37.654] Closing dangling connections. All > connections > must have a close() in a finally block. > [22:04:37.654] [22:04:37.654] {http--8080-22} > java.lang.IllegalStateException: Connection null was not closed. > Connections > must have a close() in a finally block. > [22:04:37.654] [22:04:37.654] {http--8080-22} at > > com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > > com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > > com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > > com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > > com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866) > [22:04:37.654] [22:04:37.654] {http--8080-22} at > com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779) > [22:04:37.654] [22:04:37.654] java.lang.IllegalStateException: Connection > null was not closed. Connections must have a close() in a finally block. > [22:04:37.654] at > > com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533) > [22:04:37.654] at > > com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206) > [22:04:37.654] at > > com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264) > [22:04:37.654] at > com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275) > [22:04:37.654] at > com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644) > [22:04:37.654] at > > com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311) > [22:04:37.654] at > > com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252) > [22:04:37.654] at > com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866) > [22:04:37.654] at > com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779) > [22:04:37.655] done > > > Ta points to servlet with linked code. blob00, blob01, blob02 are defined > data sources pointing to mysql servers. during execution i do not get any > exceptions thrown to the user or anything else in stdout.log > > problem seems to be gone if i move closing connection after join, outside > thead's run method. > > right now i run resin 4.0. Java(TM) SE Runtime Environment (build > 1.6.0_13-b03) under x86_64 debian, 2x quad core xeon. > > best regards, thanks for help! > > Pawel Kudzia > -- > View this message in context: > http://www.nabble.com/java.lang.IllegalStateException%3A-Connection-null-was-not-closed.-tp24593349p24596756.html > Sent from the Resin mailing list archive at Nabble.com. > > > > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest >
_______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest