[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6642) NullPointerException in method AbstractReadWriteEhcacheAccessStrategy.handleLockExpiry

Guenther Demetz (JIRA) noreply at atlassian.com
Thu Sep 8 03:18:03 EDT 2011


NullPointerException in method AbstractReadWriteEhcacheAccessStrategy.handleLockExpiry
--------------------------------------------------------------------------------------

                 Key: HHH-6642
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6642
             Project: Hibernate Core
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 4.0.0.CR2
         Environment: Hiberante4.0.0CR2, SQLServer 2008
            Reporter: Guenther Demetz
            Priority: Trivial


javax.persistence.RollbackException: Error while committing the transaction
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:90)
    at com.wuerth.phoenix.bcserver.base.PhoenixSession.executeCommit(PhoenixSession.java:642)
    at com.wuerth.phoenix.bcserver.base.PhoenixSession.transactionInternalCommit(PhoenixSession.java:546)
    at com.wuerth.phoenix.bcserver.base.PhoenixSession.transactionCommit(PhoenixSession.java:507)
    at com.wuerth.phoenix.bcserver.base.TransactionContext.commit(TransactionContext.java:260)
    at com.wuerth.phoenix.test.bart.roles.peers.RefreshOnTimestampTest.testcreateDanglingChildDueRefresh(RefreshOnTimestampTest.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.AssertionFailure: Exception releasing cache locks
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:611)
    at org.hibernate.engine.spi.ActionQueue.afterTransactionCompletion(ActionQueue.java:211)
    at org.hibernate.internal.SessionImpl.afterTransactionCompletion(SessionImpl.java:527)
    at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:145)
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.afterTransactionCompletion(JdbcTransaction.java:137)
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:182)
    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73)
    ... 24 more
Caused by: java.lang.NullPointerException
    at org.hibernate.cache.ehcache.internal.strategy.AbstractReadWriteEhcacheAccessStrategy.handleLockExpiry(AbstractReadWriteEhcacheAccessStrategy.java:182)
    at org.hibernate.cache.ehcache.internal.strategy.AbstractReadWriteEhcacheAccessStrategy.unlockItem(AbstractReadWriteEhcacheAccessStrategy.java:158)
    at org.hibernate.cache.ehcache.internal.nonstop.NonstopAwareCollectionRegionAccessStrategy.unlockItem(NonstopAwareCollectionRegionAccessStrategy.java:206)
    at org.hibernate.action.internal.CollectionAction$CacheCleanupProcess.doAfterTransactionCompletion(CollectionAction.java:195)
    at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:604)
    ... 30 more

Scenario is following: 
Transaction - commit fails --> rollback  --> open new Transaction --> commit --> reported NPE exception


Fix: 
diff AbstractReadWriteEhcacheAccessStrategy.java /home/pb00067/hibernate-ehcache4.0.0CR2/src/org/hibernate/cache/ehcache/internal/strategy/AbstractReadWriteEhcacheAccessStrategy.java   
                                         
182c182
<         LOG.softLockedCacheExpired( region.getName(), key, lock.toString() );
---
>         LOG.softLockedCacheExpired( region.getName(), key, lock != null ? lock.toString() : "null");

N.B.: As the fix is trivial, please save me this time from the duty to provide a testcase ;-)



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list