8 Replies Latest reply on Nov 5, 2008 3:48 PM by timfox

    Message is redelivered while the original transaction is sti

    szhigunov

      I get the same message received twice; in both cases transaction was committed.

      Here are the steps:
      1) Remote client reads message in XA from the remote JBM queue (transaction one).
      2) Client dies after JBM was prepared, but before commit.
      3) Client starts up, reconnects, gets the same message second time and commits (transaction two committed). That should not happen - transaction one is still in question.
      4) JBoss TS recovery thread finds transaction one and commits (transaction one committed).

      The JMS contract is broken.

      JBoss 4.2.2 + JBM 1.4.0 SP3

        • 1. Re: Message is redelivered while the original transaction is
          timfox

           

          "szhigunov" wrote:
          I get the same message received twice; in both cases transaction was committed.

          Here are the steps:
          1) Remote client reads message in XA from the remote JBM queue (transaction one).
          2) Client dies after JBM was prepared, but before commit.
          3) Client starts up, reconnects, gets the same message second time and commits (transaction two committed). That should not happen - transaction one is still in question.
          4) JBoss TS recovery thread finds transaction one and commits (transaction one committed).

          The JMS contract is broken.

          JBoss 4.2.2 + JBM 1.4.0 SP3


          If you can provide a self contained test case that we can run which demonstrates the issue, then someone will investigate.

          Best thing to do is to create a JIRA and you can attach the test case to that.

          • 2. Re: Message is redelivered while the original transaction is
            szhigunov

            OK, I will try to come up with a test case that is easy to execute. Currently I see the issue in the distributed environment and kill TS from debugger in the middle of two phase commit - not the test case I can send over.

            BTW, do you guys have any recovery test case I can take a look at?

            Thanks

            • 3. Re: Message is redelivered while the original transaction is
              gaohoward

              There is a XARecoveryTest in the source code, you can have a look.

              • 4. Re: Message is redelivered while the original transaction is
                gaohoward

                IMO, unacknowledged messages may be sent twice. In this case after the client reconnects, first thing it should do is a transaction recovery. after the tx is recovered and committed, the message is acked and never will be sent out again.

                • 5. Re: Message is redelivered while the original transaction is
                  szhigunov

                   

                  "gaohoward" wrote:
                  IMO, unacknowledged messages may be sent twice. In this case after the client reconnects, first thing it should do is a transaction recovery.


                  If that is correct, what would you recommend when two clients read from the same queue? When the first dies, the second will get the message right away and the first will recover later.

                  • 6. Re: Message is redelivered while the original transaction is
                    timfox

                     

                    "szhigunov" wrote:
                    "gaohoward" wrote:
                    IMO, unacknowledged messages may be sent twice. In this case after the client reconnects, first thing it should do is a transaction recovery.


                    If that is correct, what would you recommend when two clients read from the same queue? When the first dies, the second will get the message right away and the first will recover later.


                    No, that's not how XA works with JMS.

                    If the first consumer has consumed a message and acknowledged it in an XA transaction and that transaction branch has successfully prepared, then the server fails, then on recovery the recovery manager (not part of JBM) will decide whether to commit or rollback that branch.

                    If the branch is rolled back the message will be redelivered, if that branch is committed it will not be redelivered.

                    The second one will not get the message right away.

                    If you're seeing something different, then, as I say, create a JIRA, attach a test case and someone will take a look.

                    • 7. Re: Message is redelivered while the original transaction is
                      szhigunov

                      I have the test case, but when I try to create JIRA bug report I can not see any "attachment" link. May be I do not have permissions? I tried to contact couple people from JIRA admin list - but did not get any response.

                      • 8. Re: Message is redelivered while the original transaction is
                        timfox

                        If you send me a link to the JIRA and mail me the test case, I'll attach it.