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

Saga branch rollback retry in tm will cause null NullPointerException because StateMachineEngineHolder can not get getStateMachineEngine #7108

Open
1 task done
xjlgod opened this issue Jan 13, 2025 · 1 comment
Assignees

Comments

@xjlgod
Copy link
Contributor

xjlgod commented Jan 13, 2025

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

Ⅰ. Issue Description

I use spring-seata-saga in seata-sample repo, when saga transaction begin to retry, tm receive branchRollback request. StateMachineEngineHolder.getStateMachineEngine() will return null

Image

Ⅱ. Describe what happened

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

2025-01-13 21:57:11.729 [rpcDispatch_RMROLE_1_3_40] ERROR io.seata.saga.rm.SagaResourceManager - StateMachine forward failed, xid: 169.254.134.222:8091:72665187015102548
java.lang.NullPointerException: null
	at io.seata.saga.rm.SagaResourceManager.branchCommit(SagaResourceManager.java:89)
	at org.apache.seata.rm.AbstractRMHandler.doBranchCommit(AbstractRMHandler.java:98)
	at org.apache.seata.rm.AbstractRMHandler$1.execute(AbstractRMHandler.java:54)
	at org.apache.seata.rm.AbstractRMHandler$1.execute(AbstractRMHandler.java:50)
	at org.apache.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:127)
	at org.apache.seata.rm.AbstractRMHandler.handle(AbstractRMHandler.java:50)
	at org.apache.seata.rm.DefaultRMHandler.handle(DefaultRMHandler.java:61)
	at org.apache.seata.core.protocol.transaction.BranchCommitRequest.handle(BranchCommitRequest.java:35)
	at org.apache.seata.rm.AbstractRMHandler.onRequest(AbstractRMHandler.java:150)
	at org.apache.seata.core.rpc.processor.client.RmBranchCommitProcessor.handleBranchCommit(RmBranchCommitProcessor.java:63)
	at org.apache.seata.core.rpc.processor.client.RmBranchCommitProcessor.process(RmBranchCommitProcessor.java:58)
	at org.apache.seata.core.rpc.netty.AbstractNettyRemoting.lambda$processMessage$2(AbstractNettyRemoting.java:280)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)

Ⅲ. Describe what you expected to happen

tm retry success

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

  1. make spring-seata-saga retry fail (compensate fail)

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK 11
  • Seata client/server version: 2.4 (use 2.x branch)
@wt-better
Copy link
Contributor

Image

history saga-spring decoupling cause not incompatible.because spring needs to be decoupled, spring-based injection is not desirable.
should use StateMachineEngineHolder.setStateMachineEngine(stateMachineEngine); instead it .

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants