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

DefaultTransactionManager.begin fix #6105

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tm/src/main/java/io/seata/tm/DefaultTransactionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import io.seata.core.protocol.transaction.GlobalStatusResponse;
import io.seata.core.rpc.netty.TmNettyRemotingClient;

import java.util.Objects;
import java.util.concurrent.TimeoutException;

/**
Expand All @@ -51,7 +52,7 @@ public String begin(String applicationId, String transactionServiceGroup, String
request.setTransactionName(name);
request.setTimeout(timeout);
GlobalBeginResponse response = (GlobalBeginResponse) syncCall(request);
if (response.getResultCode() == ResultCode.Failed) {
if (Objects.isNull(response) || response.getResultCode() == ResultCode.Failed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit relevant npe test reports

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to submit UT ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what circumstances will NPE occur here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when seats-sample project runs,, but not start seats-server.sh script, occurs!
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题的根因不在这里,请你把完整堆栈发出来
The root cause of the problem is not here, please send out the complete stack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

而且堆栈是54行,你修改的是55行,你应该提交一个issue,而不是一个pr,一个记录完整异常描述和seata版本的issue

Moreover, the stack trace is at line 54 and you made a modification at line 55. You should submit an issue instead of a pull request, which includes the complete description of the exception and the version of Seata.

Copy link
Member

@slievrly slievrly Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NPE may occur in earlier versions due to request timeout, please submit an issue as detailed in the template.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

throw new TmTransactionException(TransactionExceptionCode.BeginFailed, response.getMsg());
}
return response.getXid();
Expand Down