Hi, I one of my applications deployed in weblogic application server. I often get connection leak warning message on server console (though my application flow is not affected by this warning message). I have to investigate the cause for the connection leak, first thing I have made sure is all opened connection are close correctly with in the code, still I keep getting this warning message... What would be the other possible cause for this warning message? Thanks in advance. Regards Arun
Speaking generally (I don't know how weblogic detects leaks), you get a connection leak warning because you're leaking connections, often because the exception handling is wrong and connections aren't getting closed sometimes when exceptions occur, but sometimes because there's another type of code path that hasn't been considered. Mostly, when developers think they aren't leaking connections and something else is the problem, they're wrong. Really.
However, some leak detecters will mistake a connection that's not leaked but has been checked out of a pool for longer than a threshhold value as a leak. In some cases, adjusting the leak time threshold is the fix; sometimes setting a "short operation" pool and a much smaller "long operation" pool is right; sometimes a really long running background thread shouldn't be getting its connection from a pool at all.
Joined: Nov 28, 2001
Hi, I get following message on weblogic console, I am not able to co-relate with the application code, since in application connection close is taken care off.
<Mar 13, 2006 1:07:21 AM CST> <Warning> <JDBC> <BEA-001074> <A JDBC pool connection leak was detected. A connection leak occurs when a connection obtained from the pool was not closed explicitly by calling close() and then was disposed by the garbage collector and returned to the connection pool. The following stack trace at create shows where the leaked connection was created. [Null exceptio n passed, creating stack trace for offending caller] at weblogic.utils.StackTraceUtils.throwable2StackTrace(StackTraceUtils.java:28) at weblogic.jdbc.wrapper.PoolConnection.finalize(PoolConnection.java:77) at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83) at java.lang.ref.Finalizer.access$100(Finalizer.java:14) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
Can any one give some light on this problem. Thanks Arun
Joined: Dec 15, 2005
Your code is definitely leaking connections.
That stack trace tells us exactly how weblogic is detecting leaks, and it's a technique that will never everever falsely report a leak. However, for a short run of a JVM, it might fail to report a leak, when the leaked connection isn't garbage colleced before the JVM stops.
What is happening is that the pool is returning wrapped connections; the wrapper object is weblogic.jdbc.wrapper.PoolConnection. That object has a finalize method. Finalize methods for each object, if the method exists, are invoked during Garbage Collection, just before the object is destroyed. The finalize method of weblogic.jdbc.wrapper.PoolConnection tests whether the connection is open or not; if it is the error is logged.