codingapi / codingapi/tx-lcn

SpringCloud+feign服务调用,参与方抛异常,发起方不回滚

Open
#438 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.2k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

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

### 1. Bug Description
SpringCloud+feign服务调用,参与方不回滚。例如:发起方A(注解使用的是@LcnTransaction,@Transactional)
)通过feign调用参与方B(注解@LcnTransaction(propagation = DTXPropagation.SUPPORTS)
@Transactional),B抛异常,A插入数据(不回滚)。
使用过的解决办法:
1,feign取消falback,不进行熔断,测试无效;
2,feign不取消falback,进行熔断,在添加方法的实现加入DTXUserControls.rollbackGroup(TracingContext.tracing().groupId()),测试无效;

生产环境:
腾讯云
使用Docker打txlcn的镜像,TM主机IP设置为:0.0.0.0:8070(无法设置为127.0.0.1:8070,否则TC绑定不到TM主机)
服务A配置TC主机IP为:TM主机的负载均衡IP:8070,开启了LCN的重写负载策略
服务B配置TC主机IP为:TM主机的负载均衡IP:8070,开启了LCN的重写负载策略

部署txlcn镜像日志显示:
An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: 连接被对方重设
不知是否影响?

TxManager系统后台:
已注册的TC=2(也就是A和B已绑定TM)

一切看起来很正常,正确使用了参与方与发起方的注解,但是,B服务抛出异常,曾经试过取消熔断把异常抛给A服务与加入DTXUserControls.rollbackGroup(TracingContext.tracing().groupId())代码,A服务依旧提交了事务?

请解答,万分感谢。

### 2. Environment:
- JDK version:1.8
- OS:
- TX-LCN version:5.02
- Others:

### 3. Exception Stacktrace

```
Paste your Exception Stacktrace here!
```

### 4. Tour Idea

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.