Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-22 Thread .pQd


> I'm not sure it's a bug.  Resin's connection pool handler is a  
> transactional pool, and transactions are tied to the thread.  So  
> handing off a connection to a separate thread isn't really part of the  
> pool's model.  Normally, in a multithreaded situation, you'd have a  
> second thread open its own connection.

hello Scott,

thank you very much for your explanation. now i'll know!

best regards
Pawel Kudzia

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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-22 Thread Scott Ferguson

On Jul 22, 2009, at 12:27 AM, .pQd wrote:

>
>> Try with this version http://www.copypastecode.com/7568/ that has the
>> getConnection() call inside the run method and inside the try. If  
>> that
>> still fails, I would start looking for other places where connections
>> might be retrieved as getting out of that block without calling close
>> should be not possible.
>
> new version:
> http://www.copypastecode.com/7576/
>
> as long as connection is closed in the same thread where it's open -  
> i do
> not get exceptions.
>
> if i try to close it in other thread - they occur [ rarely.. ]. is it
> general rule that i was not aware of or some bug that i trigger in  
> resin's
> connection pool handler?

I'm not sure it's a bug.  Resin's connection pool handler is a  
transactional pool, and transactions are tied to the thread.  So  
handing off a connection to a separate thread isn't really part of the  
pool's model.  Normally, in a multithreaded situation, you'd have a  
second thread open its own connection.

-- Scott

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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-22 Thread .pQd

> Try with this version http://www.copypastecode.com/7568/ that has the 
> getConnection() call inside the run method and inside the try. If that 
> still fails, I would start looking for other places where connections 
> might be retrieved as getting out of that block without calling close 
> should be not possible.

new version:
http://www.copypastecode.com/7576/

as long as connection is closed in the same thread where it's open - i do
not get exceptions.

if i try to close it in other thread - they occur [ rarely.. ]. is it
general rule that i was not aware of or some bug that i trigger in resin's
connection pool handler?

regards
Pawel Kudzia

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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-22 Thread Daniel López
.pQd escribió:
...
>> 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

Try with this version http://www.copypastecode.com/7568/ that has the 
getConnection() call inside the run method and inside the try. If that 
still fails, I would start looking for other places where connections 
might be retrieved as getting out of that block without calling close 
should be not possible.

S!


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread .pQd


> 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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread Daniel López
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()... :).

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.

And as Jon said, you should remove the dummy Connection conn = 
ds.getConnection(); piece of code, because right now it does nothing and 
adds confusion to the diagnostics. It is better to reduce it to just one 
piece of code with connections involved :).

S!
D.



.pQd escribió:
> 
> hi Jon,
> 
>> 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?
> 
> thx for your answer! 
> 
> this is just dummy code with which i can still reproduce the problem.
> i removed as much as possible [ including some try-caches ] but kept what is
> needed to reproduce the problem. i understand that code looks odd after
> taking out most of actual work that is done, but in this way it's [
> hopefully ] readable.
> 
> in my case other exceptions [ than reported IllegalStateException ] do not
> occur. 
> so none of code in catch is executed.
> 
>> Your code should be:
> 
> actually i'm very close to your suggestion. i usually run:
> }finally{
>  try{ 
>   if (conn!=null) conn.close()
>  }catch(Exception e){
>  }
> }
> 
> regards
> Pawel Kudzia


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread .pQd


hi Jon,

> 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?

thx for your answer! 

this is just dummy code with which i can still reproduce the problem.
i removed as much as possible [ including some try-caches ] but kept what is
needed to reproduce the problem. i understand that code looks odd after
taking out most of actual work that is done, but in this way it's [
hopefully ] readable.

in my case other exceptions [ than reported IllegalStateException ] do not
occur. 
so none of code in catch is executed.

> Your code should be:

actually i'm very close to your suggestion. i usually run:
}finally{
 try{ 
  if (conn!=null) conn.close()
 }catch(Exception e){
 }
}

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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread Jon Stevens
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  wrote:

>
> i can reproduce similar the problem with following code as at:
>
> http://www.copypastecode.com/7556/
>
> during execution with  ab -n 20 -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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread .pQd

i can reproduce similar the problem with following code as at:

http://www.copypastecode.com/7556/

during execution with  ab -n 20 -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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread .pQd


> If you look further down in the log, you should see that a second  
> failure saves the allocation stack trace. 

this is the whole stack trace:

[21:18:13.114] [21:18:13.113] {http--8080-12}
java.lang.IllegalStateException: Connection null was not closed. Connections
must have a close() in a finally block.
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
[21:18:13.114] [21:18:13.113] {http--8080-12}   at
com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)
[21:18:13.114] [21:18:13.114] java.lang.IllegalStateException: Connection
null was not closed. Connections must have a close() in a finally block.
[21:18:13.114]  at
com.caucho.jca.UserTransactionImpl.abortTransaction(UserTransactionImpl.java:533)
[21:18:13.114]  at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:206)
[21:18:13.114]  at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
[21:18:13.114]  at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
[21:18:13.114]  at
com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
[21:18:13.114]  at
com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
[21:18:13.114]  at
com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
[21:18:13.114]  at
com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
[21:18:13.114]  at
com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)

it's [ and it was before ] duplicated - so i did not wanted to paste
additional redundant info.
i dont get anything more before / after - just my log marker telling that
next invocation of servlet started.


> The null is strange.  Is there a chance that the connection could be  
> passed from one thread to another?
[..]
> In other words, once Resin has detected a connection-close issue, it  
> starts gathering the stack trace when the connection is allocated.   
> The next time it sees the failure, it will write the allocation to the  
> log (it will be an IllegalStateException.)  At very least, that should  
> let you know which Connection is causing trouble.

thanks a lot for your explanation, this is in line with what i thought.
your guess is right. my servlet spawns couple of threads and wait till they
finish execution.:

  thread gets as paramete sql connection and is started.
  thread code [ run ] is enclosed in try-catch-finally
  i used to close connection in finally part of that try-catch - and was
getting rarely [ but still ] exceptions as above.
  servlet waits for all threads to finish [ by calling join, looping until
thread state is Thread.State.TERMINATED ].

  i have worked-around the problem by moving closing of sql connection away
from thread code. now it's after join-loop and after few 100k runs there are
no problems. i will try to isolate the issue in some smaller readable code, 
if i manage to reproduce it i'll post the example.

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


Re: [Resin-interest] java.lang.IllegalStateException: Connection null was not closed.

2009-07-21 Thread Scott Ferguson

On Jul 21, 2009, at 11:39 AM, .pQd wrote:

>
> hi!
>
> from time to time [ say every 1000th request to one specific  
> servlet ] i see
> following exception in resin stdout.log:
>
> [18:33:06.628] [18:33:06.628] {http--8080-19}
> java.lang.IllegalStateException: Connection null was not closed.  
> Connections
> must have a close() in a finally block.

>
> i'm quite sure that my servlet closes connections properly including  
> cases
> when exceptions are thrown. i'm quite puzzled especially with  
> "Connection
> null was not closed." part.

The null is strange.  Is there a chance that the connection could be  
passed from one thread to another?

> i'm running resin 4.0, i also tried this with 4.0 snapshot  
> [ 2009.07.21 ].
>
> can you give any hints how can i trace source of this problem?

If you look further down in the log, you should see that a second  
failure saves the allocation stack trace.

In other words, once Resin has detected a connection-close issue, it  
starts gathering the stack trace when the connection is allocated.   
The next time it sees the failure, it will write the allocation to the  
log (it will be an IllegalStateException.)  At very least, that should  
let you know which Connection is causing trouble.


-- Scott

>
>
> thanks!
> best regards
> Pawel Kudzia.
> -- 
> View this message in context: 
> http://www.nabble.com/java.lang.IllegalStateException%3A-Connection-null-was-not-closed.-tp24593349p24593349.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