[jboss-jira] [JBoss JIRA] (WFLY-3220) ARJUNA016009 ArrayIndexOutOfBoundsException during periodic recovery on EJBTransactionRecoveryService

RH Bugzilla Integration (JIRA) issues at jboss.org
Sun May 4 06:18:07 EDT 2014


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

RH Bugzilla Integration commented on WFLY-3220:
-----------------------------------------------

Vaclav Tunka <vtunka at redhat.com> changed the Status of [bug 1084872|https://bugzilla.redhat.com/show_bug.cgi?id=1084872] from MODIFIED to ON_QA

> ARJUNA016009 ArrayIndexOutOfBoundsException during periodic recovery on EJBTransactionRecoveryService
> -----------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-3220
>                 URL: https://issues.jboss.org/browse/WFLY-3220
>             Project: WildFly
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: EJB
>    Affects Versions: 8.0.0.Final
>            Reporter: Masafumi Miura
>            Assignee: Masafumi Miura
>             Fix For: 8.1.0.CR1
>
>         Attachments: WFLY-3220-byteman-script.btm
>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1035216 is also reproducible in wildfly.
> {code}
> WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016009: Caught:: java.lang.ArrayIndexOutOfBoundsException: 0
> 	at org.jboss.as.ejb3.remote.EJBTransactionRecoveryService.getXAResources(EJBTransactionRecoveryService.java:114)
> 	at com.arjuna.ats.internal.jbossatx.jta.XAResourceRecoveryHelperWrapper.getXAResources(XAResourceRecoveryHelperWrapper.java:51) [narayana-jts-integration-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
> 	at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:516) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
> 	at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkFirstPass(XARecoveryModule.java:182) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
> 	at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:743) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
> 	at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [narayana-jts-jacorb-5.0.0.Final.jar:5.0.0.Final (revision: 9aa71)]
> {code}
> I think the line 111 "new XAResource\[receiverContexts.size()\]" should be placed inside synchronized block.
> {code:java|title=ejb3/src/main/java/org/jboss/as/ejb3/remote/EJBTransactionRecoveryService.java}
> 109     @Override
> 110     public XAResource[] getXAResources() {
> 111         final XAResource[] xaResources = new XAResource[receiverContexts.size()];
> 112         synchronized (receiverContexts) {
> 113             for (int i = 0; i < receiverContexts.size(); i++) {
> 114                 xaResources[i] = EJBClientManagedTransactionContext.getEJBXAResourceForRecovery(receiverContexts.get(i), arjunaTxCoreEnvironmentBean.getValue().getNodeIdentifier());
> 115             }
> 116         }
> 117         return xaResources;
> 118     }
> ...
> 124     @Override
> 125     public void receiverRegistered(final EJBReceiverContext receiverContext) {
> 126         this.receiverContexts.add(receiverContext);
> 127     }
> {code}
> I think this "java.lang.ArrayIndexOutOfBoundsException: 0" will happen in the following scenario:
> # receiverContexts.size() = 0 at the line 111 
> xaResources is created with new XAResource\[0\]
> # receiverRegistered method is called from other thread between the line 111 and 112
> Now receiverContexts.size() = 1
> # As receiverContexts.size() = 1, for-loop is executed
> Then "xaResources\[0\] = ..." will get ArrayIndexOutOfBoundsException at  the line 114 because xaResources is empty array.



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list