Road 2 Home

Road 2 Home

Tuesday, December 23, 2003

deadlock on create new jdbc connection from weblogic conn pool

On weblogic6.1


FOUND A JAVA LEVEL DEADLOCK:
----------------------------
"ExecuteThread: '10' for queue: 'default'": ==========
at
weblogic.common.internal.ResourceAllocator.makeResources
...
at weblogic.jdbc.pool.Driver.connect(Driver.java:152)
at java.sql.DriverManager.getConnection(DriverManager.java:512)

lock with

"ExecuteThread: '22' for queue: 'default'": ==========
at java.sql.DriverManager.println(DriverManager.java:419)





for this problem ,I quote a anwser from weblogic.developer.interest.jdbc newsgroup:


DriverManager.getConnection() is a class-synchronized
method, if your code calls it, and then our pool needs to also
make that call, it can lead to deadlocks, and also, any other JDBC
that may be running in the server already ahving a connection may
also halt, because drivers use DriverManager.println() to log their
actions and exceptions, and that method is also class-synchronized.
(Send complaints to JavaSoft).
We try to avoid calling DriverManager.println() in our pool code,
calling Driver.connect() directly, but for some drivers, this may
fail, so we fall back on DriverManager.getConnection().
All in all, it is much better for performance and stability to have all your
pool connecitons pre-made.

Driver d = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
Connection c = d.connect("jdbc:weblogic:pool:myPoolName", null);


Joseph Weinstein