> One potential source of problems might be the start/run sequence of the 
> Thread. If, for some reason, the run() method was never called then the 
> Thread's connection would never be called. The "problem" with this 
> theory is that I cannot think of any reason for start() to fail to call 
> run()... :).

new sample code with which i can still reproduce the problem:

http://www.copypastecode.com/7560/

i've removed unnecessary comment and added sanity check: control if thread
was executed.

sporadically i get result in stdout.log:
[06:42:55.708] start
[06:42:55.709] stop
[06:42:55.709] [06:42:55.709] {http--8080-27} Closing dangling connections. 
All connections must have a close() in a finally block.
[06:42:55.709] [06:42:55.709] Closing dangling connections.  All connections
must have a close() in a finally block.
[06:42:55.709] [06:42:55.709] {http--8080-27}
java.lang.IllegalStateException: Connection null was not closed. Connections
must have a close() in a finally block.
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
[06:42:55.709] [06:42:55.709] {http--8080-27}   at
com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)
[06:42:55.709] [06:42:55.709] java.lang.IllegalStateException: Connection
null was not closed. Connections must have a close() in a finally block.
[06:42:55.709]                  at
com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533)
[06:42:55.709]                  at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206)
[06:42:55.709]                  at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
[06:42:55.709]                  at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
[06:42:55.709]                  at
com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
[06:42:55.709]                  at
com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
[06:42:55.709]                  at
com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
[06:42:55.709]                  at
com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
[06:42:55.709]                  at
com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)
[06:42:55.710] start
[06:42:55.710] stop

rest is just:
[06:42:55.714] stop
[06:42:55.714] start
[06:42:55.715] stop
[06:42:55.715] start
[06:42:55.716] stop
[06:42:55.716] start
[06:42:55.717] stop
[06:42:55.717] start
[06:42:55.717] stop



> Just to verify that's not the problem, you could pass the DBPool as 
> parameter to the tread and perform the DBPool.getConnection() inside the 
> thread's run method, so the connection is retrieved in the same method 
> where you are sure it is going to be returned.

if i move DBPool.getConnection() inside the thread - exception still [
rarely ] occurs:
http://www.copypastecode.com/7564/

thanks for your suggestions

Pawel Kudzia

-- 
View this message in context: 
http://www.nabble.com/java.lang.IllegalStateException%3A-Connection-null-was-not-closed.-tp24593349p24600985.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

Reply via email to