EHC ❯ EhcacheXAResourceImpl.recover() incorrectly marks recovered contexts as rollback only
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
ehcache-core
-
-
hsingh
-
Reporter: lorban
-
April 01, 2010
-
0
-
Watchers: 0
-
January 17, 2013
-
April 06, 2010
Description
In the h2lcperf test when BTM runs background recovery these warnings are sometimes reported:
2010-03-31 02:57:57,680 WARN [Recoverer] - <error running recovery on resource ‘org.springframework.samples.petclinic.PetType@petClinic.cacheManager’, resource marked as failed (background recoverer will retry recovery)>
java.lang.NullPointerException
at org.terracotta.modules.ehcache.xa.XidClustered.
2010-03-31 02:15:48,867 WARN [Recoverer] - <error running recovery on resource ‘org.springframework.samples.petclinic.Owner@petClinic.cacheManager’, resource marked as failed (background recoverer will retry recovery)> java.lang.IllegalStateException: Context was marked as commited already! at org.terracotta.modules.ehcache.xa.PreparedContextClusteredImpl.__tc_wrapped_setRolledBack(PreparedContextClusteredImpl.java:59) at org.terracotta.modules.ehcache.xa.PreparedContextClusteredImpl.setRolledBack(PreparedContextClusteredImpl.java) at net.sf.ehcache.transaction.xa.EhcacheXAResourceImpl.markContextForRollback(EhcacheXAResourceImpl.java:585) at net.sf.ehcache.transaction.xa.EhcacheXAResourceImpl.recover(EhcacheXAResourceImpl.java:283) at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:74) at bitronix.tm.recovery.RecoveryHelper.recover(RecoveryHelper.java:39) at bitronix.tm.recovery.Recoverer.recover(Recoverer.java:205) at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:174) at bitronix.tm.recovery.Recoverer.run(Recoverer.java:113) at java.lang.Thread.run(Thread.java:619) 2010-03-31 02:15:48,870 INFO [Recoverer] - <recovery committed 0 dangling transaction(s) and rolled back 0 aborted transaction(s) on 9 resource(s) [org.springframework.samples.petclinic.Specialty@petClinic.cacheManager, org.springframework.samples.petclinic.PetType@petClinic.cacheManager, org.springframework.samples.petclinic.Owner.petsInternal@petClinic.cacheManager, org.springframework.samples.petclinic.Visit@petClinic.cacheManager, [email protected], [email protected], org.springframework.samples.petclinic.Vet.specialtiesInternal@petClinic.cacheManager, org.springframework.samples.petclinic.Pet.visitsInternal@petClinic.cacheManager, mysql] (restricted to serverId ‘h2lcperf’)>
This is because in EhcacheXAResourceImpl.recover() there is this snippet of code:
for (Xid preparedXid : xids) {
markContextForRollback(preparedXid);
}
XAResource.recover() isn’t supposed to do anything with in-doubt transactions but merely report them. It’s up to the TM to act on them.
Comments
Ludovic Orban 2010-04-01
Ludovic Orban 2010-04-06
This method call was there for a good reason, it was just poorly named
Ludovic Orban 2010-04-06
re-enabled method call in recover() + fixed related race conditions
Himadri Singh 2010-04-28
Verified by running h2lcperf test in Ehcache Core version 2.1.0-SNAPSHOT was built on 2010-04-27 11:37:49, at revision 2348, with jdk 1.6.0_15
Fixed in trunk.