This is an automated email from the ASF dual-hosted git repository.

jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 4959cfb490 bugfix: Use xaActive to determine whether xaResource needs 
to execute the end method (#7708)
4959cfb490 is described below

commit 4959cfb49009d3e4c349fd2c95e590184bd5a9a8
Author: shukai <[email protected]>
AuthorDate: Thu Nov 20 16:47:13 2025 +0800

    bugfix: Use xaActive to determine whether xaResource needs to execute the 
end method (#7708)
---
 changes/en-us/2.x.md                                               | 2 ++
 changes/zh-cn/2.x.md                                               | 2 ++
 .../java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java  | 7 ++-----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 9028c50d32..3035531dcc 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -47,6 +47,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7662](https://github.com/apache/incubator-seata/pull/7662)] ensure 
visibility of rm and The methods in MockTest are executed in order
 - [[#7683](https://github.com/apache/incubator-seata/pull/7683)] Override 
XABranchXid equals() and hashCode() to fix memory leak in mysql driver
 - [[#7643](https://github.com/apache/incubator-seata/pull/7643)] fix DM 
transaction rollback not using database auto-increment primary keys
+- [[#7708](https://github.com/apache/incubator-seata/pull/7708)] Use xaActive 
to determine whether xaResource needs to execute the end method
 - [[#7747](https://github.com/apache/incubator-seata/pull/7747)] undo log 
table name dynamic derivation
 - [[#7749](https://github.com/apache/incubator-seata/pull/7749)] fix error 
parsing application/x-www-form-urlencoded requests in Http2HttpHandler
 - [[#7761](https://github.com/apache/incubator-seata/pull/7761)] special 
handling is applied to the Byte[] type to ensure the correct primary key value
@@ -158,6 +159,7 @@ Thanks to these contributors for their code commits. Please 
report an unintended
 - [dsomehan](https://github.com/dsomehan)
 - [LegendPei](https://github.com/LegendPei)
 - [lokidundun](https://github.com/lokidundun)
+- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
 - [jsbxyyx](https://github.com/jsbxyyx)
 - [xingfudeshi](https://github.com/xingfudeshi)
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index adddd6f180..31e126e0ca 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -47,6 +47,7 @@
 - [[#7662](https://github.com/apache/incubator-seata/pull/7662)] 确保 rm 的可见性,并且 
MockTest 中的方法按顺序执行
 - [[#7683](https://github.com/apache/incubator-seata/pull/7683)] 重写 
XABranchXid的equals和hashCode,解决mysql driver内存泄漏问题
 - [[#7643](https://github.com/apache/incubator-seata/pull/7643)] 修复 DM 
事务回滚不使用数据库自动增量主键
+- [[#7708](https://github.com/apache/incubator-seata/pull/7708)] 
使用xaActive判断xaResource是否需要执行end方法
 - [[#7747](https://github.com/apache/incubator-seata/pull/7747)] 
支持undo_log序列名动态推导
 - [[#7749](https://github.com/apache/incubator-seata/pull/7749)] 修复 
Http2HttpHandler 解析 application/x-www-form-urlencoded 请求失败的问题
 - [[#7761](https://github.com/apache/incubator-seata/pull/7761)] 对 Byte[] 
类型进行了特殊处理,以确保主键值正确
@@ -154,6 +155,7 @@
 - [dsomehan](https://github.com/dsomehan)
 - [LegendPei](https://github.com/LegendPei)
 - [lokidundun](https://github.com/lokidundun)
+- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
 - [jsbxyyx](https://github.com/jsbxyyx)
 - [xingfudeshi](https://github.com/xingfudeshi)
 
diff --git 
a/rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
 
b/rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
index ff7f5b3294..6c2c670e97 100644
--- 
a/rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
+++ 
b/rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
@@ -56,8 +56,6 @@ public class ConnectionProxyXA extends 
AbstractConnectionProxyXA implements Hold
 
     private volatile boolean xaActive = false;
 
-    private volatile boolean xaEnded = false;
-
     private volatile boolean kept = false;
 
     private volatile boolean rollBacked = false;
@@ -119,9 +117,9 @@ public class ConnectionProxyXA extends 
AbstractConnectionProxyXA implements Hold
     }
 
     private void xaEnd(XAXid xaXid, int flags) throws XAException {
-        if (!xaEnded) {
+        if (xaActive) {
             xaResource.end(xaXid, flags);
-            xaEnded = true;
+            xaActive = false;
         }
     }
 
@@ -302,7 +300,6 @@ public class ConnectionProxyXA extends 
AbstractConnectionProxyXA implements Hold
     }
 
     private void cleanXABranchContext() {
-        xaEnded = false;
         branchRegisterTime = null;
         prepareTime = null;
         xaActive = false;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to