fandyvon / activejdbc

Automatically exported from code.google.com/p/activejdbc
0 stars 0 forks source link

DB.close() does not work as expected #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
JDBC drivers has connection inactive timeout, when it expires they close 
connection. Then activeweb encounters CONNECTION LEAK DETECTED ... and 
AVERTED!!! tried to close with DB.closeAllConnections() but it failed with DB - 
Could not close connection: java.lang.RuntimeException: Uncaught underlying 
exception. All subsequent request in that thread failed with Cannot open a new 
connection because existing connection is still on current thread, dbName: 
default, connection instance: ProxyConnection[null]. This might indicate a 
logical error in your application. because dead connection is still in 
ThreadLocal ConnectionsAccess. 

Lets make log in DB proper: not + e but , e so the stack trace and underlying 
exceptions are logged, not only meaningless message. Other thing is that 
detach() should be called in finally {} so that even if anything bad happened 
resources and thread locals are released as expected

Original issue reported on code.google.com by s...@expresspigeon.com on 14 Dec 2012 at 8:10

GoogleCodeExporter commented 9 years ago

Original comment by i...@polevoy.org on 16 Dec 2012 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by i...@polevoy.org on 16 Dec 2012 at 8:43

GoogleCodeExporter commented 9 years ago
How about this code:
https://gist.github.com/4312749

Original comment by i...@polevoy.org on 16 Dec 2012 at 8:47

GoogleCodeExporter commented 9 years ago
actually, this is even better:
https://gist.github.com/4312786

Original comment by i...@polevoy.org on 16 Dec 2012 at 8:51

GoogleCodeExporter commented 9 years ago
this has been fixed and pushed to Sonatype as 1.4.6-SNAPSHOT

Original comment by i...@polevoy.org on 19 Dec 2012 at 12:43