-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: when the routing policy is not set, the setInvokers() method has a co process leak #2104
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## 1.5 #2104 +/- ##
==========================================
- Coverage 55.82% 54.90% -0.93%
==========================================
Files 279 267 -12
Lines 16071 15151 -920
==========================================
- Hits 8972 8318 -654
+ Misses 6154 5952 -202
+ Partials 945 881 -64
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
caochengxiang
changed the title
非路由策略下,不触发节点变更的数据变更协程消息
When the routing policy is not set, the setInvokers() method has a co process leak
Nov 10, 2022
caochengxiang
changed the title
When the routing policy is not set, the setInvokers() method has a co process leak
fix: when the routing policy is not set, the setInvokers() method has a co process leak
Nov 10, 2022
AlexStocks
approved these changes
Nov 10, 2022
AlexStocks
requested review from
zhaoyunxing92,
georgehao,
justxuewei and
AlbumenJ
November 10, 2022 03:00
justxuewei
reviewed
Nov 10, 2022
justxuewei
approved these changes
Nov 10, 2022
zhaoyunxing92
approved these changes
Nov 10, 2022
binbin0325
approved these changes
Nov 10, 2022
AlbumenJ
approved these changes
Nov 10, 2022
pls do not merge this pr until @caochengxiang add an ut. |
AlexStocks
reviewed
Nov 15, 2022
Kudos, SonarCloud Quality Gate passed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1、1.5.7版本不指定路由策略下会发生协程泄漏,通过pprof发现下面两处会有协程泄漏,cluster/router/chain/chain.go;
`func (c *RouterChain) AddRouters(routers []router.PriorityRouter) {
newRouters := make([]router.PriorityRouter, 0, len(c.builtinRouters)+len(routers))
newRouters = append(newRouters, c.builtinRouters...)
newRouters = append(newRouters, routers...)
sortRouter(newRouters)
c.mutex.Lock()
defer c.mutex.Unlock()
c.routers = newRouters
}
// SetInvokers receives updated invokers from registry center. If the times of notification exceeds countThreshold and
// time interval exceeds timeThreshold since last cache update, then notify to update the cache.
func (c *RouterChain) SetInvokers(invokers []protocol.Invoker) {
c.mutex.Lock()
c.invokers = invokers
c.mutex.Unlock()
}`
这里面两处的c.notify <- struct{}{}会阻塞,因为loop方法不会运行