apache / apache/incubator-seata

spring cloud with hystrix and seata, the service provider or RM is not wrapped in branch transaction

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

Description

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

### Ⅰ. Issue Description

this issue is related to this one, [The spring cloud project uses both seata, sleuth, hystrix, and SeataFeignClientAutoConfiguration conflicts.](https://github.com/seata/seata/issues/1560)
i'm test seata with spring cloud and seata, when i set feign.hystrix.enabled=true, application can't startup, then i set spring.main.allow-bean-definition-overriding=true, the startup was ok, but when i tested the service, i found the service provider is not wrappeed in branch transaction.

### Ⅱ. Describe what happened

as we can see from seata server log, there was only one branch transation in global transaction, the service provider was not registered a branch transation.

```
2019-10-30 17:44:28.800 INFO [ServerHandlerThread_20_500]io.seata.server.coordinator.DefaultCore.begin:145 -Successfully begin global transaction xid = 10.10.10.246:8091:2026133972
2019-10-30 17:44:30.339 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:198 -SeataMergeMessage xid=10.10.10.246:8091:2026133972,branchType=AT,resourceId=jdbc:mysql://localhost:3306/business,lockKey=business:3
,clientIp:10.10.10.158,vgroup:my_test_tx_group
2019-10-30 17:44:30.347 INFO [ServerHandlerThread_21_500]io.seata.common.loader.EnhancedServiceLoader.loadFile:236 -load Locker[file] extension by class[io.seata.server.lock.memory.MemoryLocker]
2019-10-30 17:44:30.349 INFO [ServerHandlerThread_21_500]io.seata.server.coordinator.DefaultCore.lambda$branchRegister$0:94 -Successfully register branch xid = 10.10.10.246:8091:2026133972, branchId = 2026133973
2019-10-30 17:44:30.450 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:198 -SeataMergeMessage xid=10.10.10.246:8091:2026133972,branchId=2026133973,resourceId=null,status=PhaseOne_Done,applicationData=null
,clientIp:10.10.10.158,vgroup:my_test_tx_group
2019-10-30 17:44:30.450 INFO [ServerHandlerThread_22_500]io.seata.server.coordinator.DefaultCore.branchReport:118 -Successfully branch report xid = 10.10.10.246:8091:2026133972, branchId = 2026133973
2019-10-30 17:44:30.457 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:198 -SeataMergeMessage xid=10.10.10.246:8091:2026133972,extraData=null
,clientIp:10.10.10.158,vgroup:my_test_tx_group
2019-10-30 17:44:31.115 INFO [AsyncCommitting_1]io.seata.server.coordinator.DefaultCore.doGlobalCommit:303 -Global[10.10.10.246:8091:2026133972] committing is successfully done.
```

### Ⅲ. 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?

i seted breakpoint both at SeataFeignClientAutoConfiguration and TraceFeignClientAutoConfiguration, it seems like SeataFeignClientAutoConfiguration was not executed.
![image](https://user-images.githubusercontent.com/11673316/67848680-16c50480-fb40-11e9-90b3-6807fd1ec7c6.png)
![image](https://user-images.githubusercontent.com/11673316/67848689-1c224f00-fb40-11e9-9585-7aacd6ff8e54.png)

### Ⅵ. Environment:

- JDK version :1.8
- OS :ubantu
- Others:spring cloud version Hoxton.M3, seata 0.9

Contributor guide

Open the contributing guide

Research direction

Start by comparing SeataFeignClientAutoConfiguration with TraceFeignClientAutoConfiguration, focusing on why the former is not executed when feign.hystrix.enabled=true. Reproduce the startup and service-call sequence using the stated Spring Cloud Hoxton.M3 and Seata 0.9 environment, then verify that the service provider or RM is wrapped and registers a branch transaction.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.