apache / apache/incubator-seata

io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished

Open
#3,576 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
A服务调用B服务 B服务进行本地查询校验信息,没通过并抛出异常信息给A服务,这个时候B服务没有分支注册到seata服务端,之后A服务进行回滚成功并且事务结束。后续对B服务进行操作 数据插入、修改、删除都会走图下方法
![image](https://user-images.githubusercontent.com/47582444/111555651-cba6a280-87c3-11eb-8c1b-4a893bce915e.png)

之后自动重新把之前的B服务的xid自动绑定,并报入下错误
2021-03-17 10:58:56.930 biz_service_ebtp_resps [http-nio-18013-exec-6] INFO c.c.m.e.c.e.service.BusinessExceptionHandlerAdvice - org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished.] ]
### Ⅱ. Describe what happened
服务端日志
Line 33128: 2021-03-17 10:54:45.489 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 33129: 2021-03-17 10:54:45.489 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext
Line 33637: 2021-03-17 10:56:29.579 biz_service_ebtp_resps [http-nio-18013-exec-6] INFO c.c.m.e.c.e.service.BusinessExceptionHandlerAdvice - org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished.] ]
Line 33986: 2021-03-17 10:57:36.752 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 33987: 2021-03-17 10:57:36.753 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext
Line 34298: 2021-03-17 10:58:40.528 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728

A客户端日志
Line 130427: 2021-03-17 10:54:20.480 biz_service_ebtp_bid [http-nio-18003-exec-8] INFO io.seata.tm.api.DefaultGlobalTransaction - Begin new global transaction [172.29.33.139:8091:115404011428425728]
Line 130428: 2021-03-17 10:54:20.480 biz_service_ebtp_bid [http-nio-18003-exec-8] INFO c.c.m.e.b.anno.service.impl.BizBidAnnoServiceImpl - 发起事务 xid:172.29.33.139:8091:115404011428425728
Line 130459: 2021-03-17 10:54:22.854 biz_service_ebtp_bid [http-nio-18003-exec-8] INFO c.c.m.e.b.anno.service.impl.BizBidAnnoServiceImpl - ------------------------------------------- 172.29.33.139:8091:115404011428425728 -------------------------------------------
Line 130510: 2021-03-17 10:54:23.963 biz_service_ebtp_bid [http-nio-18003-exec-8] INFO io.seata.tm.api.DefaultGlobalTransaction - [172.29.33.139:8091:115404011428425728] rollback status: Rollbacked

B客户端日志seata事务当中方法报错信息 导致A服务进行回滚
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4fb8057a]
2021-03-17 10:53:38.019 biz_service_ebtp_resps [http-nio-18013-exec-1] INFO c.c.m.e.r.feign.supplierInfo.FeignConfiguration - toke返回数据:---------------------- {"code":"1","success":true,"message":"请求成功","data":{"value":"d973068c-5811-406b-a5cb-494093e104be","expiration":"2021-03-18 08:26:46","tokenType":"bearer","refreshToken":{"expiration":"2021-04-16 08:26:46","value":"7a8fb621-3946-40ce-9d08-4d925be34b87"},"scope":["all"],"additionalInformation":{}}}
2021-03-17 10:53:38.020 biz_service_ebtp_resps [http-nio-18013-exec-1] INFO c.c.m.e.r.feign.supplierInfo.FeignConfiguration - token=======d973068c-5811-406b-a5cb-494093e104be
Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4fb8057a]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4fb8057a]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4fb8057a]
2021-03-17 10:53:55.355 biz_service_ebtp_resps [DiscoveryClient-HeartbeatExecutor-0] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_BIZ-SERVICE-EBTP-RESPS/http://10.242.31.158:18013 - Re-registering apps/BIZ-SERVICE-EBTP-RESPS
2021-03-17 10:53:55.355 biz_service_ebtp_resps [DiscoveryClient-HeartbeatExecutor-0] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_BIZ-SERVICE-EBTP-RESPS/http://10.242.31.158:18013: registering service...
2021-03-17 10:53:55.358 biz_service_ebtp_resps [DiscoveryClient-HeartbeatExecutor-0] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_BIZ-SERVICE-EBTP-RESPS/http://10.242.31.158:18013 - registration status: 204
Creating a new SqlSession
Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
JDBC Connection [io.seata.rm.datasource.ConnectionProxy@733595c5] will be managed by Spring
==> Preparing: SELECT id,catalog_id,name,content_type,file_id,size,properties,add_content_num,file_type,remark,sort FROM biz_resps_tdoc_catalog_content_temp WHERE catalog_id=?
==> Parameters: 1372017483736678400(String)
<== Columns: id, catalog_id, name, content_type, file_id, size, properties, add_content_num, file_type, remark, sort
<== Row: 1372017483736678401, 1372017483736678400, 报价文件扫描件, 6, null, null, null, null, null, null, null
<== Total: 1
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518] from current transaction
==> Preparing: SELECT id,content_id,name,data_type,default_value,is_empty,is_predata,memo,sort FROM biz_resps_tdoc_content_table_temp WHERE (content_id = ?)
==> Parameters: 1372017483736678401(String)
<== Total: 0
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2ac9c518]
2021-03-17 10:54:12.800 biz_service_ebtp_resps [http-nio-18013-exec-10] ERROR c.c.m.e.c.s.s.filter.TokenAuthenticationFilter - null
2021-03-17 10:54:12.801 biz_service_ebtp_resps [http-nio-18013-exec-10] INFO c.c.m.e.r.tdoc.service.impl.TdocCatalogServiceImpl - 投标文件查看----当前用户是否可查看报价----getViewPriceDivide参数:
2021-03-17 10:54:13.042 biz_service_ebtp_resps [http-nio-18013-exec-10] INFO c.c.m.e.r.feign.supplierInfo.FeignConfiguration - toke返回数据:---------------------- {"code":"1","success":true,"message":"请求成功","data":{"value":"d973068c-5811-406b-a5cb-494093e104be","expiration":"2021-03-18 08:26:46","tokenType":"bearer","refreshToken":{"expiration":"2021-04-16 08:26:46","value":"7a8fb621-3946-40ce-9d08-4d925be34b87"},"scope":["all"],"additionalInformation":{}}}
2021-03-17 10:54:13.043 biz_service_ebtp_resps [http-nio-18013-exec-10] INFO c.c.m.e.r.feign.supplierInfo.FeignConfiguration - token=======d973068c-5811-406b-a5cb-494093e104be
2021-03-17 10:54:13.075 biz_service_ebtp_resps [http-nio-18013-exec-10] ERROR c.c.m.e.c.bizmessage.error.BizMessageErrorDecoder - Publish Message error: {"code":400,"success":false,"message":"参数缺失Required String parameter 'assessId' is not present"}
2021-03-17 10:54:13.076 biz_service_ebtp_resps [http-nio-18013-exec-10] ERROR c.c.m.e.resps.feign.rsms.RsmsFeignFallbackFactory - java.lang.Exception: {"code":400,"success":false,"message":"参数缺失Required String parameter 'assessId' is not present"}
at com.chinaunicom.mall.ebtp.common.bizmessage.error.BizMessageErrorDecoder.decode(BizMessageErrorDecoder.java:20)

B服务本地插入操作日志
Line 33128: 2021-03-17 10:54:45.489 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 33129: 2021-03-17 10:54:45.489 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext
Line 33637: 2021-03-17 10:56:29.579 biz_service_ebtp_resps [http-nio-18013-exec-6] INFO c.c.m.e.c.e.service.BusinessExceptionHandlerAdvice - org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished.] ]
Line 33986: 2021-03-17 10:57:36.752 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 33987: 2021-03-17 10:57:36.753 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext
Line 34298: 2021-03-17 10:58:40.528 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 34299: 2021-03-17 10:58:40.529 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext
Line 34528: 2021-03-17 10:58:56.930 biz_service_ebtp_resps [http-nio-18013-exec-6] INFO c.c.m.e.c.e.service.BusinessExceptionHandlerAdvice - org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished.] ]
Line 34680: 2021-03-17 10:59:37.704 biz_service_ebtp_resps [http-nio-18013-exec-6] INFO c.c.m.e.c.e.service.BusinessExceptionHandlerAdvice - org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: io.seata.core.exception.RmTransactionException: Response[ TransactionException[Could not found global transaction xid = 172.29.33.139:8091:115404011428425728, may be has finished.] ]
Line 34922: 2021-03-17 11:00:10.807 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - xid in change during RPC from null to 172.29.33.139:8091:115404011428425728
Line 34923: 2021-03-17 11:00:10.807 biz_service_ebtp_resps [http-nio-18013-exec-6] WARN io.seata.integration.http.XidResource - bind [172.29.33.139:8091:115404011428425728] back to RootContext

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

### Ⅴ. Anything else we need to know?

### Ⅵ. Environment:

- JDK version :1.8.0_231
- OS : linux
- Others:
- springboot :2.3
- mybatis-plus:3.4.0
- druid:1.1.21
-

Contributor guide

Open the contributing guide

Research direction

Start by reading the io.seata.integration.http.XidResource binding logs alongside the io.seata.tm.api.DefaultGlobalTransaction rollback logs. Reproduce the described A/B service flow and trace why the finished xid is rebound before the later JDBC commit; the issue provides no repository file, test, expected behavior, or complete reproduction steps, so completion criteria are not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.