Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSpringCloud+feign服务调用,参与方抛异常,发起方不回滚 #438
Open
Comments
|
我的解决步骤,或许能帮助到你 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
3. Exception Stacktrace
4. Tour Idea