-->

JBoss spamming XA Recovery warnings

2019-04-10 19:48发布

问题:

I'm running a JPA/Spring application that connects to multiple XA enabled datasources on Microsoft SQL Server. Everything works just fine, with global transactions correctly starting and rolling back as needed...

But, every now and then JBoss goes wild and starts spamming the following warning every few seconds:

10:25:22,524 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: The function RECOVER: failed. The status is: -3. Error: "*** SQLJDBC_XA DTC_ERROR Context: xa_recover, state=1, StatusCode:-3 (0xFFFFFFFD) ***"
    at com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:550)
    at com.microsoft.sqlserver.jdbc.SQLServerXAResource.recover(SQLServerXAResource.java:728)
    at org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.recover(XAManagedConnection.java:358)
    at org.jboss.jca.core.tx.jbossts.XAResourceWrapperImpl.recover(XAResourceWrapperImpl.java:162)
    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]
    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]
    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]
    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]
    at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]
    at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

So far I haven't been able to decipher what I'm expected to do here and I'm a bit worried about putting an application in such state into production.

Can anyone shed some light on why this is happening, how to resolve and avoid it?

EDIT:

In Windows logs I couldn't find anything that looks like a DTC error:

MSDTC started with the following settings:

Security Configuration (OFF = 0 and ON = 1): Allow Remote Administrator = 0, Network Clients = 0, Transaction Manager Communication: Allow Inbound Transactions = 0, Allow Outbound Transactions = 0, Transaction Internet Protocol (TIP) = 0, Enable XA Transactions = 1, Enable SNA LU 6.2 Transactions = 1, MSDTC Communications Security = Mutual Authentication Required, Account = NT AUTHORITY\NetworkService, Firewall Exclusion Detected = 0

Transaction Bridge Installed = 0 Filtering Duplicate Events = 1


Attempting to initialize Microsoft Distributed Transaction Coordinator (MS DTC). This is an informational message only. No user action is required.


Recovery of any in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC) has completed. This is an informational message only. No user action is required.


Recovery completed for database MyDatabase (database ID 20) in 1 second(s) (analysis 589 ms, redo 0 ms, undo 398 ms.) This is an informational message only. No user action is required.

回答1:

Had the same problem.

How did I solve it? Using the distributed transactions (inserting some data in my case).

My guess, and I say guess because the sqljdbc4.jar source code has not being released and can not tell what really is the issue. Well, my guess is that each time your jboss server starts, your distributed transaction framework checks for transactions to be recovered. These are hold in a table that the first time is empty, so this raise the warning (com.microsoft.sqlserver.jdbc.SQLServerXAResource.DTC_XA_Interface(SQLServerXAResource.java:550) ) because again the xp_sqljdbc_xa_recover stored procedure cannot find anything (I'm guessing again).

So basically, inserted something into the databases using distributed transaction and run again the jboss/tomcat server to get rid of the warning.



回答2:

I have the same problem, the error keep showing regardless which instance I run as long it point out to the same DBMS. When I run stored procedure "xp_sqljdbc_xa_recover" the issue resolved by itself. As pointed out by Painy James



回答3:

You either don't have XA enabled in the DTC, or forgot to grant the SqlJDBCXAUser role.