AlexStocks commented on code in PR #3591:
URL: https://github.com/apache/dubbo-go/pull/3591#discussion_r3710896798
##########
graceful_shutdown/shutdown_test.go:
##########
@@ -114,7 +116,9 @@ func resetShutdownTestState() {
shutdownStarted = atomic.Bool{}
shutdownDone = make(chan struct{})
shutdownResult = nil
+ shutdownSignalError = make(chan error, 1)
signalNotify = signal.Notify
+ signalStop = signal.Stop
Review Comment:
[P1] 等待信号 goroutine 退出后再重置测试 hook
`TestInit` 使用默认内部信号配置,退出时仍遗留一个阻塞在 `<-signals` 的 goroutine;下一测试在这里写回包级变量
`signalStop`,会与该 goroutine在 `shutdown.go:113` 求值 `defer signalStop(signals)`
并发。当前 Head 上执行 `go test -race ./graceful_shutdown -run TestInit -count=1` 稳定退出
1,Race Detector 直接定位这两处读写。请让不测试信号的用例使用 `WithoutInternalSignal()`;信号相关用例则应在
cleanup 中停止、解除阻塞并等待 goroutine 退出后再重置全局状态。仅把 stop 函数复制为局部值仍不能解决跨测试 goroutine 泄漏。
--
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]