First of all, I am using Oracle and JBoss 4.0.4 and I'm pretty much a newbie on JBoss matters.
Our d开发者_运维问答istributed application uses CMP beans with SimpleReadWrite... etc locking policy, which I'm told seemed the best choice at the time. (Original developers are no longer working with us and I can't easily get feedback from them, not mentioning the utter lack of documentation).
The relevant configuration is as follows:
<container-configuration extends="Standard CMP 2.x EntityBean with cache invalidation">
<container-name>Standard CMP 2.x EntityBean</container-name>
<locking-policy>org.jboss.ejb.plugins.lock.SimpleReadWriteEJBLock</locking-policy>
<container-cache-conf>
<cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
<cache-policy-conf>
<min-capacity>150</min-capacity>
<max-capacity>1000000</max-capacity>
<overager-period>600</overager-period>
<max-bean-age>1800</max-bean-age>
<resizer-period>400</resizer-period>
<max-cache-miss-period>60</max-cache-miss-period>
<min-cache-miss-period>1</min-cache-miss-period>
<cache-load-factor>0.75</cache-load-factor>
</cache-policy-conf>
</container-cache-conf>
<container-pool-conf>
<MaximumSize>1000</MaximumSize>
</container-pool-conf>
<cache-invalidation>true</cache-invalidation>
</container-configuration>
The application is used every day, including weekends, from early in the morning until 9-10 pm. Sometimes (e.g. once-twice a month) we get this kind of error:
2010-01-25 13:41:10,567 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=anemosa1/3531484, BranchQual=, localId=3531484] timed out. status=STATUS_ACTIVE
2010-01-25 13:41:14,225 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.lang.Long org.anemos.ejb.dictionary.LongId.getId(), causedBy:
javax.ejb.EJBException: Transaction marked for rollback - probably a timeout.
at org.jboss.ejb.plugins.lock.SimpleReadWriteEJBLock.checkTransaction(SimpleReadWriteEJBLock.java:340)
at org.jboss.ejb.plugins.lock.SimpleReadWriteEJBLock.waitAWhile(SimpleReadWriteEJBLock.java:219)
at org.jboss.ejb.plugins.lock.SimpleReadWriteEJBLock.getReadLock(SimpleReadWriteEJBLock.java:153)
...many more lines...
A transaction times out and subsequently locks every other transaction, from every other user, on the locked out tables. Every time this happens we have to reset the services or kill the locked up DB session... or hope that the problem will solve itself (sometimes the lock is lifted in a matter of seconds).
What could be wrong? A more specific question is, why the timed out transaction ends up locking the resource instead of being quietly rollbacked? Any help is appreciated.
This looks to be a bug in jboss 4.0.
I forgot to include the relevant parts from the original configuration:
<container-configuration>
<container-name>Standard CMP 2.x EntityBean with cache invalidation</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
<container-interceptors>
...
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
<instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
<locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
<container-cache-conf>
...
</container-cache-conf>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
<commit-option>A</commit-option>
</container-configuration>
精彩评论