Thread deadlock - How does Oracle JDBC behave?
843854May 19 2004 — edited May 20 2004We are running JDK1.4 on Solaris 2.8, with either Oracle 9.2.0.3 or 10.1.0.2 JDBC driver, over both THIN and OCI connections. We are having problem identifying the source of thread deadlock. We set autoCommit=OFF. Only SELECT statements runs on the threads. I know that with commit() the JDBC driver will lock both the connection and all statements associated with the connection.
From Oracle SQL trace I am sure that there is no commit within the processing except the very last commit at the end of each connection. From the thread dump is appears that the two deadlock threads are sharing the same connection and same resultset object. We have not figured out why these two threads are sharing the same connection and resultsets. (Some design issues and some investigation here).
To help me continue investigation, could someone help and explain:
1) In what condition (in addition to commit) JDBC driver will lock both Connection and Statement? (see the following)
2) From this java thread dump (10.1.0.2 driver), are both connection/statement objects locked right after the executeQuery opeation. Can I suppose that there is a commit after the executeQuery()?
"abc.def.ReqManager":
at oracle.jdbc.driver.ScrollableResultSet.close(ScrollableResultSet.java:117)
- waiting to lock <f2d0af30> (a oracle.jdbc.driver.ScrollableResultSet)
at oracle.jdbc.driver.OracleStatement.doScrollExecuteCommon(OracleStatement.java:3746)
at oracle.jdbc.driver.OracleStatement.doScrollStmtExecuteQuery(OracleStatement.java:3887)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1131)
- locked <f2d0af88> (a oracle.jdbc.driver.T4CStatement)
- locked <f2c30350> (a oracle.jdbc.driver.T4CConnection)
at abc.def.QueryManager.getResultData(QueryManager.java:132)
at abc.def.ReqManager.executeNewQuery(ReqManager.java:731)
��
at abc.def.ReqManagerThread.execute(ReqManagerThread.java:66)
at abc.def.MyThread.run(MyThread.java:51)
"com.sswitch.oam.scm.SubTermReqMgr":
at oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:2078)
- waiting to lock <f2c30350> (a oracle.jdbc.driver.T4CConnection)
at Oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:257)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:197)
- locked <f2d0b1f8> (a oracle.jdbc.driver.OracleResultSetImpl)
at oracle.jdbc.driver.ScrollableResultSet.cacheRowAt(ScrollableResultSet.java:1457)
at oracle.jdbc.driver.ScrollableResultSet.isValidRow(ScrollableResultSet.java:1441)
at oracle.jdbc.driver.ScrollableResultSet.absolute(ScrollableResultSet.java:385)
- locked <f2d0af30> (a oracle.jdbc.driver.ScrollableResultSet)
at abc.def.ReplyDataTable.getFromResultSet(ReplyDataTable.java:466)
�..
Found 1 deadlock.
Thanks!!!