Similarityoung commented on code in PR #1017:
URL: https://github.com/apache/dubbo-go-pixiu/pull/1017#discussion_r3788746284


##########
pkg/listener/http/http_listener.go:
##########
@@ -96,13 +112,30 @@ func (ls *HttpListenerService) ShutDown(wg any) error {
                cancel()
                wg.(*sync.WaitGroup).Done()
        }()
-       return ls.srv.Shutdown(ctx)
+       serverErr := ls.srv.Shutdown(ctx)
+       filterErr := error(nil)
+       ls.filterMu.Lock()
+       filterChain := ls.FilterChain
+       ls.FilterChain = nil
+       ls.filterMu.Unlock()

Review Comment:
   `http.Server.Shutdown(ctx)` 在上下文超时后可以返回,但活跃请求此时仍可能持有 
`filterMu.RLock`,而这段代码会在返回前立即获取 `filterMu.Lock`。 因此,`ShutDown` 
仍会等待请求结束,监听器管理器的停机等待可能因长连接而超过配置的超时时间。 请避免在超时路径上获取这把锁,或将过滤器链清理从受超时时间约束的停机调用中解耦。



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