[opencms-dev] OpenCMS v5 and Oracle Deadlock

ian snead wickedfey at gmail.com
Wed Feb 16 19:20:35 CET 2005


Hello all,

We have been hitting the reported deadlock condition discussed in the past.

I realize this will be fixed in the upcomming v6, but in the meantime...

I've been doing some reading into the data layer, and I wanted to suggest a
patch. Is there any reason not to do the following ?

In com.opencms.dbpool.CmsPool, 

    + Remove all the .notify() calls to the stack.
    + Synchronize on DriverManager.class instead of the stack.

It looks like the race condition is between the stack and the driver manager
class instance monitors, would this solve it?

I've done this, and things look just fine on my machine. Have not subjected
the server to a load test yet. 

If anything jumps out at you about this, I'd love the feedback!!!

Thanks,

Ian Snead
Applications Analyst
Georgia State Department of Audits and Accounts, IT Division


Here is a pertinant stack dump from kill -3 on Tomcat :

"http-8443-Processor15":
	at com.opencms.dbpool.CmsPool.getConnection(CmsPool.java:217)
	- waiting to lock <0x392d0d10> (a java.util.Stack)  <---------- stack
of connections
	at com.opencms.dbpool.CmsPool.connect(CmsPool.java:206)
	at com.opencms.dbpool.CmsDriver.connect(CmsDriver.java:107)
	at java.sql.DriverManager.getConnection(DriverManager.java:512)
	- locked <0xaf87b628> (a java.lang.Class)
	at java.sql.DriverManager.getConnection(DriverManager.java:193)
	- locked <0xaf87b628> (a java.lang.Class)
	at com.opencms.file.genericSql.CmsDbAccess.readFile(CmsDbAccess.java:6060)
	at com.opencms.file.genericSql.CmsResourceBroker.readFile(CmsResourceBroker.java:5203)
	at com.opencms.file.CmsObject.readFile(CmsObject.java:2888)
	at com.opencms.core.OpenCms.initResource(OpenCms.java:793)
	at com.opencms.core.OpenCmsHttpServlet.doGet(OpenCmsHttpServlet.java:363)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

"http-8443-Processor23":
	at java.sql.DriverManager.getDrivers(DriverManager.java:321)
	- waiting to lock <0xaf87b628> (a java.lang.Class)
	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:305)
	at com.opencms.dbpool.CmsPool.createConnection(CmsPool.java:338)
	at com.opencms.dbpool.CmsPool.createConnections(CmsPool.java:320)
	at com.opencms.dbpool.CmsPool.putConnection(CmsPool.java:301)
	- locked <0x392d0d10> (a java.util.Stack)

Code changes in CmsPool, swap :

synchronized(m_availableConnections) 
    to
synchronized(DriverManager.class)
    and
m_availableConnections.notify();
    to
// m_availableConnections.notify();



More information about the opencms-dev mailing list