Description of problem:
1. Start EAP 6.2.0.ER1 server with queues InQueue and OutQueue
2. Send 10000 messages to InQueue
3. Deploy MDB which reads messages from InQueue and sends to OutQueue
4. Wait until MDB processes all messages and start consumer which reads all messages from OutQueue
During step 3. there are errors in log:
17:20:00,441 ERROR [stderr] (Periodic Recovery) javax.transaction.xa.XAException
17:20:00,441 ERROR [stderr] (Periodic Recovery) at org.hornetq.core.client.impl.ClientSessionImpl.rollback(ClientSessionImpl.java:1692)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at org.hornetq.core.client.impl.DelegatingSession.rollback(DelegatingSession.java:494)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.rollback(HornetQXAResourceWrapper.java:126)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.handleOrphan(XARecoveryModule.java:738)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecoverySecondPass(XARecoveryModule.java:644)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:417)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:194)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789)
17:20:00,441 ERROR [stderr] (Periodic Recovery) at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371)
Error above is caused by calling rollback on XID during periodic recovery which HornetQ RA does not know and throw XAException to TM which then e.printStackTrace() to log:
17:20:00,445 ERROR [org.hornetq.core.client] (Periodic Recovery) mnovak: Now this is the problem!!!!!!!!!! Calling rollback on transaction with xid:: xid=XidImpl (1237619510 bq:0.0.0.0.0.0.0.0.0.0.-1.-220.127.116.11.1.-60.28.-71.-18.104.22.168.-22.214.171.124.-126.96.36.199.0.0.0.0.0 formatID:131077 gtxid:0.0.0.0.0.0.0.0.0.0.-1.-188.8.131.52.1.-60.28.-71.-184.108.40.206.-220.127.116.11.-18.104.22.168.51.53.50 base64:AAAAAAAAAAAAAP__fwAAAcQcubtSOxWTAAAVzgAAAAAAAAAAAAAAAAAAAAAAAP__fwAAAcQcubtSOxWTAAAVzTUyNDM1MgcCAgA=,clientXID=< formatId=131077, gtrid_length=34, bqual_length=36, tx_uid=0:ffff7f000001:-3be34645:523b1593:15cd, node_name=524352, branch_uid=0:ffff7f000001:-3be34645:523b1593:15ce, subordinatenodename=null, eis_name=unknown eis name > clientXID=< formatId=131077, gtrid_length=34, bqual_length=36, tx_uid=0:ffff7f000001:-3be34645:523b1593:15cd, node_name=524352, branch_uid=0:ffff7f000001:-3be34645:523b1593:15ce, subordinatenodename=null, eis_name=unknown eis name >. Response from this call is: PACKET(SessionXAResponseMessage)[type=55, channelID=10, packetObject=SessionXAResponseMessage] with error code: -4
Problem is that tx_uid: 0:ffff7f000001:-3be34645:523b1593:15cd was successfully committed and for some reason periodic recovery finds it (when it should be already removed) and tries to commit it.
Created attachment 800020 [details]
Search for "mnovak" to find problem tx_uid.
was there any crash?
There is no crash. It's positive scenario.
If you want I can give you access to prepared environment where is possible to run and debug the test.
What can happen is this:
0. Transaction::commit begins
1. HornetQ is xa_prepare(xid1)'d
2. Recovery manager calls xa_recover() on HQ which returns xid1 from above
3. Transaction calls xa_commit(xid1) on HornetQ
3. System under load so takes a more than the RecoveryManager safety interval period (10 seconds) for the recovery thread to resume
4. Periodic recovery thread can find no trace of the transaction so it tries to rollback the XID
This will not cause data integrity issues but will have spurious rollbacks in the logs
Note that there is a field on RecoveryXids that is not configurable that defines how long the interval is between to decide if the Xid is indoubt. It is set to 10 seconds:
The commit over here shows the scenario:
thanks for your feedback. Do you think there is a way to get rid of those rollbacks?
Our customers are watching server logs very closely and error messages when no crash happened is very confusing.
No problem Mirek,
I suggest an enhancement request to make it configurable. If you raise one on Jira I will get right on it: https://issues.jboss.org/browse/JBTM
Thanks Tom and sorry. For EAP 6 I have to track this issue on bz. Do you think you can get the enhancement to EAP 6.2.0.ER5?
When is component freeze for EAP 6.2.0.ER5?
I created an enhancement request over on Jira for you for the JBTM part. There would need to be a WFLY issue to expose the new config via the AS for it to be formally accepted as supportable (and QE would need to test it)
So, like I mentioned above. I have raised a PR on JBTM with a change to allow the value to be configurable, however exposing this to via standalone.xml config would require a change to the app server.
That said, with the PR merged, the config can still be enabled in an unsupported manner via a system property:
com.arjuna.ats.jta.JTAEnvironmentBean.orphanSafetyInterval (default is 10000)
The component upgrade linked to provides the ability to set the value you need via a system property, it does not expose the value to the CLI
Michael Musgrove <firstname.lastname@example.org> updated the status of jira JBTM-1943 to Closed
I help to Mirek with verification of this issue.
The correct name of attribute that is needed to be set is
com.arjuna.ats.jta.orphanSafetyInterval (default is 10000)
Mirek ran his test with several values of the attribute. When we set the attribute to be 20s (20000) we still get the XAExceptions time to time. When we redefine the time being 40s (40000) the exception disappeared from the log.
I think that I can verify this issue just don't you think that it would be better to set the default interval time a bit bigger?
For not to get the error as default behavior. But I'm not sure how would it influence the whole recovery process. It's true that the problem occurs on faster machines under the load of receiving a bigger amount of messages.
a one more request. I've added a doc text to this bug but I don't think that my text is well written. Could you please check it and polish it?
The text was broadly correct to me, I reworded the initial few sentences:
"When a machine is under heavy load it may happen that the server log contains XAExceptions caused by the Recovery Manager attempting to rollback a resource that has already committed. The transaction is in fact not rolled back at all, the commit is done but meanwhile the Periodic Recovery process comes into play and potentially sees now stale resources"
If you want the default time changing that is easy, but we should raise a different BZ I think.
thank you. I agree with raising the different BZ for that. Just I will need to discussed it with Miroslav when he will come back to work after holidays. I think that it won't be possible for 6.2.0 either.
I have drafted a release notes entry. Please review what I have written and provide feedback.
I've slightly changed the doc text to say that the increasing timeout does not solve the problem in general but just the probability to see the warnings is lower.
Minor grammatical editing to the Release Notes text.
Its worth pointing out in the release notes that there is _no_ implication on data integrity. The transaction has already been committed prior to the attempt to rollback the resource manager.
Tom Jenkinson <email@example.com> updated the status of jira JBTM-2583 to Closed
Tom Jenkinson <firstname.lastname@example.org> updated the status of jira JBTM-2583 to Reopened