mochengqian commented on code in PR #3307:
URL: https://github.com/apache/dubbo-go/pull/3307#discussion_r3145376645


##########
protocol/base/base_protocol.go:
##########
@@ -87,13 +97,19 @@ func (bp *BaseProtocol) Refer(url *common.URL) Invoker {
 
 // Destroy will destroy all invoker and exporter, so it only is called once.
 func (bp *BaseProtocol) Destroy() {
+       // Do not hold invokersLock while calling Invoker.Destroy(); 
implementations may run protocol callbacks.
+       bp.invokersLock.Lock()
+       invokers := make([]Invoker, len(bp.invokers))
+       copy(invokers, bp.invokers)
+       bp.invokers = nil

Review Comment:
   Good catch! nil 和 []Invoker{} 对当前核心行为几乎等价:len == 0、range 安全、后续 append 
都正常,仔细想了想确实是不必要修改.我将把 nil 还原回 []Invoker{}.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to