Arjuna JTA `OutOfMemoryError: Java heap` when starting JBoss

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 5.2.0

Issue

  • The following error in the JBoss server log during startup:
ERROR [STDERR] (Thread-10):  java.lang.OutOfMemoryError: Java heap space
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.arjuna.state.InputBuffer.unpackString(InputBuffer.java:400)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.restore_state(XAResourceRecord.java:1114)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.arjuna.coordinator.BasicAction.restore_state(BasicAction.java:1416)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.arjuna.coordinator.BasicAction.activate(BasicAction.java:717)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.arjuna.coordinator.BasicAction.activate(BasicAction.java:679)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.arjuna.recovery.RecoverAtomicAction.<init>(RecoverAtomicAction.java:60)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.doRecoverTransaction(AtomicActionRecoveryModule.java:178)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.processTransactionsStatus(AtomicActionRecoveryModule.java:294)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.periodicWorkSecondPass(AtomicActionRecoveryModule.java:128)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:799)
ERROR [STDERR] (Thread-10):     at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:412)
...
INFO  [org.jboss.bootstrap.microcontainer.ServerImpl] (main):  JBoss (Microcontainer) [5.2.0 (build: SVNTag=JBPAPP_5_2_0 date=201211232041)] Started in 37s:900ms

Resolution

If it is determined there will be no loss of data, or that there would be a tolerable loss of data, delete the transaction data: <JBoss install>/jboss-as/server/<configuration>/data/tx-object-store.

Root Cause

The issue happens on this line[1]:
byte[] b = new byte[length-1];

When a transaction is written to disk, part of the transaction data is the size used to allocate a byte array upon deserialization. When bad data is deserialized, it can result in an huge array size being determined, causing OutOfMemoryError when the JVM tries to allocate it.

[1]Content from svn.jboss.org is not included.https://svn.jboss.org/repos/labs/labs/jbosstm/tags/JBOSSTS_4_6_1_GA_CP13/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/state/InputBuffer.java

Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.