feign远程调用,事务回滚不生效
- Ngôn ngữ chính
- Java
- Star
- 4.2k
- Fork
- 1.4k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 1. Bug Description
>a服务调用b服务,b服务的事务抛异常,a服务的事务不会回滚
### 2. Environment:
- JDK version: **1.8**
- OS: **win7**
- TX-LCN version: **5.0.2**
- Others:
> springboot:**2.0.4.RELEASE**
> springcloud: **Finchley.SR1**
>注册中心:**eureka**
### 3. Exception Stacktrace
>a服务调用b服务的方式是feign,b服务的日志输出如下:
```
2019-04-08 16:27:41.922 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tracing.Tracings [51] -| tracing apply group:154e4aad55f537, app map:e30=
2019-04-08 16:27:41.923 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.aspect.weave.DTXLogicWeaver [60] -| <---- TxLcn start ---->
2019-04-08 16:27:41.924 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.context.DefaultGlobalContext [150] -| Start TxContext[154e4aad55f537]
2019-04-08 16:27:41.924 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.DTXServiceExecutor [59] -| pre business code, unit type: lcn @group(154e4aad55f537)
2019-04-08 16:27:41.926 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.aspect.weave.DTXResourceWeaver [50] -| proxy a sql connection: com.codingapi.txlcn.tc.core.transaction.lcn.resource.LcnConnectionProxy@79cdd3f5.
2019-04-08 16:27:41.928 |-DEBUG [http-nio-9002-exec-3] com.test.service.e.mapper.ExUserMapper.addUserByXml [159] -| ==> Preparing: insert into user(name,age,score) values(?,?,?)
2019-04-08 16:27:41.929 |-DEBUG [http-nio-9002-exec-3] com.test.service.e.mapper.ExUserMapper.addUserByXml [159] -| ==> Parameters: 10(String), 10(Integer), null
2019-04-08 16:27:41.932 |-DEBUG [http-nio-9002-exec-3] com.test.service.e.mapper.ExUserMapper.addUserByXml [159] -| <== Updates: 1
2019-04-08 16:27:41.936 |-ERROR [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.DTXServiceExecutor [70] -| business code error @group(154e4aad55f537)
2019-04-08 16:27:41.944 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.template.TransactionCleanTemplate [59] -| clean transaction @group(154e4aad55f537)
2019-04-08 16:27:41.944 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.transaction.lcn.resource.LcnConnectionProxy [50] -| rollback transaction type[lcn] proxy connection:com.codingapi.txlcn.tc.core.transaction.lcn.resource.LcnConnectionProxy@79cdd3f5.
2019-04-08 16:27:41.949 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.transaction.lcn.resource.LcnConnectionProxy [54] -| transaction type[lcn] proxy connection:com.codingapi.txlcn.tc.core.transaction.lcn.resource.LcnConnectionProxy@79cdd3f5 closed.
2019-04-08 16:27:41.950 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.template.TransactionCleanTemplate [59] -| clean transaction over @group(154e4aad55f537)
2019-04-08 16:27:41.950 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.context.DefaultGlobalContext [162] -| Destroy TxContext[154e4aad55f537]
2019-04-08 16:27:41.951 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.core.DTXLocalContext [170] -| clean thread local[DTXLocalContext]: DTXLocalContext(transactionType=lcn, groupId=154e4aad55f537, unitId=63104376c261440a03d3308f64fa602f, resource=null, destroy=true, inGroup=false, attachment=null, sysTransactionState=1, userTransactionState=-1, proxy=true, justNow=false, proxyTmp=false)
2019-04-08 16:27:41.951 |-DEBUG [http-nio-9002-exec-3] com.codingapi.txlcn.tc.aspect.weave.DTXLogicWeaver [113] -| <---- TxLcn end ---->
2019-04-08 16:27:41.959 |-ERROR [http-nio-9002-exec-3] com.test.cloud.common.exception.GlobalExceptionHandler [33] -| / by zero
java.lang.ArithmeticException: / by zero
```
### 4. Tour Idea
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lệnh gọi Feign từ A đến B với JDK 1.8, TX-LCN 5.0.2, Spring Boot 2.0.4.RELEASE, Spring Cloud Finchley.SR1 và Eureka. So sánh log giao dịch và rollback từ cả hai service; hoàn thành khi một exception ở B cũng khiến giao dịch của A được rollback.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, spring-boot
- Lĩnh vực
- api, backend, distributed-systems
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100