[jbossts-issues] [JBoss JIRA] (JBTM-2256) Race condition between recovery manager initialization and expiry scanner

Tom Jenkinson (JIRA) issues at jboss.org
Thu Sep 18 05:39:02 EDT 2014

    [ https://issues.jboss.org/browse/JBTM-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003788#comment-13003788 ] 

Tom Jenkinson commented on JBTM-2256:

Hi Gytis,

The way to reproduce the bug is to put a breakpoint here:

If you do that and you have a scanner configured and that needs to create an abstract record of say type 172 (for example, as the ExpiredAssumedCompleteScanner in the linked BZ may need to), it will fail.

This is a reproducer I have to verify it: https://github.com/tomjenkinson/narayana/compare/4.17...JBTM-2256

You need to add the breakpoint in RecoveryManagerImple after it has started the expiry scanner but before it loads the recovery modules (line 113 above). You can also add a breakpoint in the reproducer class on "AbstractRecord.create(172);"

If you allow the AbstractRecord.create(172); before you release the RecoveryManagerImple you will see:
	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at com.arjuna.ats.arjuna.coordinator.AbstractRecord.create(AbstractRecord.java:446)
	at com.hp.mwtests.ts.jta.jts.recovery.RecoveryManagerUnitTest$1.scan(RecoveryManagerUnitTest.java:41)
	at com.arjuna.ats.internal.arjuna.recovery.ExpiredEntryMonitor.run(ExpiredEntryMonitor.java:171)

Swapping the lines does not allow this scenario to occur. I think you should add a comment into your fix to provide more details on this so it is not swapped back in the future.


> Race condition between recovery manager initialization and expiry scanner
> -------------------------------------------------------------------------
>                 Key: JBTM-2256
>                 URL: https://issues.jboss.org/browse/JBTM-2256
>             Project: JBoss Transaction Manager
>          Issue Type: Bug
>          Components: Transaction Core
>            Reporter: Gytis Trikleris
>            Assignee: Gytis Trikleris
>             Fix For: 4.17.23, 5.0.4
> In a constructor of RecoveryManagerImple expiry scanner is started before initiating PeriodicRecovery. This causes a problem from time to time, because during the initiation of PeriodicRecovery (more exact XARecoveryModule) ExtendedResourceRecord is added to the RecordTypeManager. It has to be there during the expiry scan execution. Since expiry scanner works in a separate thread it works most of the time, but race condition still exists. Personally I couldn't reproduce the problem.
> Swapping these two actions should solve the problem.

This message was sent by Atlassian JIRA

More information about the jbossts-issues mailing list