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


##########
registry/servicediscovery/store/cache_manager.go:
##########
@@ -108,6 +108,7 @@ func (cm *CacheManager) loadCache() error {
        if err != nil {
                return err
        }
+       defer cf.Close()

Review Comment:
   [P1] 为 Decode 失败路径补充可证明句柄已关闭的回归测试
   当前 PR 没有修改任何测试;我在 WSL/Linux 上对 exact Base `53d81d17`(仍会在 `decoder.Decode` 
返回非 EOF 错误时泄漏 `cf`)和当前 Head `5829ebf3` 执行同一条 `go test -count=1 
./registry/servicediscovery/store`,两者都通过,说明现有门禁无法检测这个修复被删除或回退。建议构造截断/损坏的 gob 
文件,重复触发 `loadCache` 的 Decode 错误,并通过可注入的 open/close seam 或 Linux fd 
计数断言每次打开都被关闭;该用例在 Base 上必须失败、在 Head 上通过。



##########
filter/accesslog/filter.go:
##########
@@ -339,6 +342,10 @@ func (f *Filter) openLogFile(accessLog string) (*os.File, 
error) {
        // By this way, we can split the access log based on days.
        // use 'accessLog' as complete path to avoid log not found.
        if now != last {
+               if closeErr := logFile.Close(); closeErr != nil {

Review Comment:
   [P1] 为旋转及错误返回路径补充文件句柄回归测试
   这里修复了 `Stat` 失败、关闭后旋转以及 `Rename` 失败时的所有权,但 PR 没有新增测试;exact Base `53d81d17` 
含原泄漏实现时,`go test -count=1 ./filter/accesslog` 与当前 Head 一样通过。因此后续删除这些 `Close` 
调用仍会保持 CI 绿色。建议通过可注入的文件操作 seam 故障注入 `Stat/Rename/OpenFile`,逐项断言失败返回前旧句柄已关闭;另用过期 
mtime 文件覆盖成功旋转,并做一次 Base 失败、Head 通过的验证。



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