#718 Locks in jtds-1.3.1 while parsing stored procedure

v1.3
open
nobody
Locks (1)
5
2013-11-22
2013-11-22
Stepan Melnik
No

Found that jtds-1.3.1 locks a stored procedure call in ibatis2 version.
You can easy reproduce the lock in unit test, see SQLParserTest.java in the attachment.

The following stacktrace shows a lock on production:
java.lang.Thread.State: RUNNABLE
at net.sourceforge.jtds.jdbc.SQLParser.skipWhiteSpace(SQLParser.java:442)
at net.sourceforge.jtds.jdbc.SQLParser.callEscape(SQLParser.java:555)
at net.sourceforge.jtds.jdbc.SQLParser.escape(SQLParser.java:992)
at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:1178)
at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:165)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.<init>(JtdsPreparedStatement.java:111)
at net.sourceforge.jtds.jdbc.JtdsCallableStatement.<init>(JtdsCallableStatement.java:70)
at net.sourceforge.jtds.jdbc.JtdsConnection.prepareCall(JtdsConnection.java:2426)
- locked <0x00000007d9cd80d0> (a net.sourceforge.jtds.jdbc.JtdsConnection)
at net.sourceforge.jtds.jdbc.JtdsConnection.prepareCall(JtdsConnection.java:2412)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:958)
at com.sun.proxy.$Proxy56.prepareCall(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.ibatis.common.jdbc.logging.ConnectionLogProxy.invoke(ConnectionLogProxy.java:60)
at com.sun.proxy.$Proxy56.prepareCall(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:274)
at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:696)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:666)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:111)
at com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)
at com.viskan.api.dao.framework.core.persistence.OfflineViskanDaoTemplate.queryForList(OfflineViskanDaoTemplate.java:316)
at com.viskan.estore.modules.shopcart.model.ShopcartDao.summary(ShopcartDao.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
at com.sun.proxy.$Proxy35.summary(Unknown Source)
at com.viskan.estore.modules.shopcart.model.ShopcartAndLoginGetter.run(ShopcartAndLoginGetter.java:69)
at com.viskan.estore.framework.persistence.spunit.ThreadedTestRunner$TestWorker.run(ThreadedTestRunner.java:112)

Locked ownable synchronizers:
- None

1 Attachments

Discussion