AlexStocks commented on code in PR #3235:
URL: https://github.com/apache/dubbo-go/pull/3235#discussion_r2902464903


##########
protocol/triple/triple.go:
##########
@@ -47,6 +47,30 @@ var (
 
 func init() {
        extension.SetProtocol(TRIPLE, GetProtocol)
+
+       // register graceful shutdown callback
+       extension.SetGracefulShutdownCallback(TRIPLE, func(ctx context.Context) 
error {
+               tp := GetProtocol()
+               if tp == nil {
+                       return nil
+               }
+
+               var ok bool
+               tripleProtocol = tp.(*TripleProtocol)
+               if !ok {

Review Comment:
   类型断言写错了:`tripleProtocol = tp.(*TripleProtocol)` 没有捕获 `ok`,而 `var ok bool` 
声明后从未赋值,始终是 `false`。导致 `if !ok { return nil }` 
永远成立,回调永远提前返回,`grpc.GracefulStop()` 从不执行。triple 的 graceful shutdown 完全失效。
   
   建议改为:
   ```go
   tripleProtocol, ok := tp.(*TripleProtocol)
   if !ok {
       return nil
   }
   ```



-- 
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