Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1152410

Summary: XA consumer must recreate sessions after failover
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Miroslav Novak <mnovak>
Component: HornetQAssignee: Andy Taylor <ataylor>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav Novak <mnovak>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: ataylor, csuconic, jbertram, msvehla
Target Milestone: DR8   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-02 07:30:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Novak 2014-10-14 06:14:18 UTC
Standalone JMS client which is consuming messages in XA transaction must recreate session after failover to receive messages after failover. 

Session should be reconnected automatically. 

To reproduce the problem follow those steps:
clone our testsuite from git:
git://git.app.eng.bos.redhat.com/jbossqe/eap-tests-hornetq.git

Go to eap-tests-hornetq/scripts and run groovy script PrepareServers.groovy with -DEAP_VERSION=6.4.0.DR4 parameter:
groovy -DEAP_VERSION=6.4.0.DR4 PrepareServers.groovy

(Script will prepare 4 servers - server1..4 in the directory where are you currently standing.)

Export these paths to server directories + directory for shared journal and mcast addresse.:
export JBOSS_HOME_1=$PWD/server1/jboss-eap
export JBOSS_HOME_2=$PWD/server2/jboss-eap
export JBOSS_HOME_3=$PWD/server3/jboss-eap
export JBOSS_HOME_4=$PWD/server4/jboss-eap
export JOURNAL_DIRECTORY_A=$PWD/journal-A
export MCAST_ADDR=235.3.4.5

Now comment following lines in XAConsumerTransAck:
                    session.close();
                    xaSession.close();

                    xaSession = con.createXASession();
                    session = xaSession.getSession();
                    consumer = session.createConsumer(queue);


And finally: go to jboss-hornetq-testsuite/ in our testsuite and run
mvn install -Peap6x-xa-clients -Dtest=XAFailoverTestCase#testFailoverWithXAConsumerKillBeforeCommit

Comment 1 Andy Taylor 2014-10-14 09:48:14 UTC
I have run this test many times without failure, are there any steps missing from the instructions?

Comment 2 Miroslav Novak 2014-10-14 11:44:47 UTC
It's a different test:
-Dtest=XAFailoverTestCase#testFailoverWithXAConsumerKillAfterEnd

Looks like it's dependent on the moment when live is killed.

Comment 3 Miroslav Novak 2014-10-14 11:52:16 UTC
One note, "XA consumer" is forced to use 2 phase commit. Otherwise it's not deterministic for it what to do with messages in failed XA transaction.

Comment 4 Andy Taylor 2014-10-16 11:39:16 UTC
ive fixed this in all branches

Comment 5 Miroslav Novak 2014-11-05 08:14:14 UTC
Verified in EAP 6.4.0.DR8. Thanks for the fix!