tx-lcn icon indicating copy to clipboard operation
tx-lcn copied to clipboard

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

Open suntyan opened this issue 6 years ago • 1 comments

  • [ ] I have searched the 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

suntyan avatar Sep 05 '19 07:09 suntyan

https://github.com/codingapi/tx-lcn/issues/481

我的解决步骤,或许能帮助到你

yuntao1997 avatar Dec 25 '19 02:12 yuntao1997