Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[seata-java] XA模式在某些情况下,分支事务已经回滚,但TC仍会重试回滚直到超时 #709

Open
1 task done
luky116 opened this issue Nov 23, 2024 · 1 comment · May be fixed by #717
Open
1 task done

Comments

@luky116
Copy link
Contributor

luky116 commented Nov 23, 2024

refer: apache/incubator-seata#5833

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

XA模式,在执行 connection.start() 前,收到 TC 的回滚请求,此时由于分支事务还没开始会回滚失败,然后将分支状态改为 PhaseTwo_Rollbacked , 接着执行 start(),此时 termination()方法由于状态是PhaseTwo_Rollbacked而抛异常,catch住后,回滚分支事务成功,没有报告给 TC,然后 TC 会一直回滚直到超时

    private synchronized void start() throws XAException, SQLException {
        ...
        try {
            termination();
        } catch (SQLException e) {
            // the framework layer does not actively call ROLLBACK when setAutoCommit throws an SQL exception
            xaResource.end(this.xaBranchXid, XAResource.TMFAIL);
            xaRollback(xaBranchXid);
            throw  e;
        }
    }

Ⅱ. Describe what happened

TC侧

14:07:55.393  INFO --- [     batchLoggerPrint_1_1] [ocessor.server.BatchLogHandler] [                 run]  [] : receive msg[single]: BranchRollbackResponse{xid='192.168.70.224:8091:540864619345956865', branchId=540864619345956875, branchStatus=PhaseTwo_RollbackFailed_XAER_NOTA_Retryable, resultCode=Success, msg='null'}, clientIp: 192.168.70.224, vgroup: tx_group_shopping
14:07:55.393  INFO --- [     RetryRollbacking_1_1] [server.coordinator.DefaultCore] [a$doGlobalRollback$3]  [192.168.70.224:8091:540864619345956865] : Rollback branch XAER_NOTA retry timeout, xid = 192.168.70.224:8091:540864619345956865 branchId = 540864619345956875

RM侧

14:07:55.392 [rpcDispatch_RMROLE_1_24_24] DEBUG i.s.c.r.p.c.RmBranchRollbackProcessor.65 - branch rollback result:BranchRollbackResponse{xid='192.168.70.224:8091:540864619345956865', branchId=540864619345956875, branchStatus=PhaseTwo_RollbackFailed_XAER_NOTA_Retryable, resultCode=Success, msg='null'}

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version(e.g. java -version):
  • Seata client/server version:
  • Database version:
  • OS(e.g. uname -a):
  • Others:
@Code-Fight
Copy link
Contributor

pls assign to me

@Code-Fight Code-Fight linked a pull request Nov 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants