AlexStocks commented on code in PR #1017:
URL: https://github.com/apache/dubbo-go-pixiu/pull/1017#discussion_r3802800766
##########
pkg/listener/http/http_listener.go:
##########
@@ -83,7 +83,18 @@ func (ls *HttpListenerService) Start() error {
}
func (ls *HttpListenerService) Close() error {
- return ls.srv.Close()
+ serverErr := error(nil)
+ if ls.srv != nil {
+ serverErr = ls.srv.Close()
+ }
+ filterErr := error(nil)
+ if ls.FilterChain != nil {
+ filterErr = ls.FilterChain.Close()
Review Comment:
[P1] 当前修复会把资源泄漏换成 listener 级停流:ServeHTTP 在整个请求期间持有 filterMu.RLock,而 Refresh
需要写锁。Go RWMutex 在 writer 等待后会阻塞后续 reader,所以只要请求 A 是流式/长请求,Refresh
就无法完成;刷新开始等待后,请求 B 也无法进入旧链或新链。判别探针持有一个旧请求读锁、启动 Refresh,再启动第二个
reader,第二个请求会一直阻塞到旧请求释放。已有 FilterManager factory lease 已能在活跃 chain Release 后关闭旧
factory;这里应先原子切换到新 chain,让新请求立即使用它,再由 lease/drain 回收旧 chain,而不是用 listener
读锁覆盖整个请求。
--
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]