Deadlock on method with TransactionType Supports
vbatista Aug 6, 2008 5:30 PMHello,
I am using JBoss 4.2.2GA with Java6.
I am having a deadlock on a method with SUPPORTS Transaction Type.
I have one Clustered Singleton which imports data to my database every N minutes, through a method on a session bean with REQUIRED Transaction Type.
On my Portal I am querying the same data through a method with TransactionType SUPPORTS. When the import Singleton is executing, and I am with heavy load on my Portal, I have some exceptions like the one below:
2008-08-06 19:15:21,129 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1205, SQLState: 40001 2008-08-06 19:15:21,129 ERROR [org.hibernate.util.JDBCExceptionReporter] Transaction (Process ID 60) was deadlocked on lock resources with another process an d has been chosen as the deadlock victim. Rerun the transaction. 2008-08-06 19:15:21,140 ERROR [org.hibernate.ejb.AbstractEntityManagerImpl] Unable to mark for rollback on PersistenceException: java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.nosuchtx] [com.arjuna.ats.internal.jta.transaction.arjunacore.nosuchtx] No such transaction! at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.setRollbackOnly(BaseTransaction.java:189) at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.setRollbackOnly(BaseTransactionManagerDelegate.java:135) at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:432) at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:587) at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
I am using Microsoft SQL Server Express, and my Datasourse looks like:
<datasources> <local-tx-datasource> <jndi-name>MyDS</jndi-name> <connection-url>jdbc:jtds:sqlserver://my-ip:1433/MyDB</connection-url> <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> <user-name>my-user</user-name> <password>my-passwd</password> <connection-property name="char.encoding">UTF-8</connection-property> <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation> <!--pooling parameters--> <min-pool-size>10</min-pool-size> <max-pool-size>100</max-pool-size> <blocking-timeout-millis>5000</blocking-timeout-millis> <idle-timeout-minutes>15</idle-timeout-minutes> <check-valid-connection-sql>select 0</check-valid-connection-sql> </local-tx-datasource> </datasources>
It seems that my SUPPORTS method is acquiring Locks it shouldn't, and a deadlock is raised...followed a Rollback on a method without Transaction.
How can I avoid this behavior? I wan't my SUPPORTS methods to read data, without acquiring any Locks, while my Singleton is writing it.
Should I change any configuration on Arjuna? On the Database?
Thanks in advance.
Best regards,
Victor Batista