openGemini / opengemini-client-go

CNCF openGemini Go Client Library
https://opengemini.org/
Apache License 2.0
24 stars 17 forks source link

endpoint 健康检查失效风险 #87

Closed wolfbolin closed 4 months ago

wolfbolin commented 4 months ago

https://github.com/openGemini/opengemini-client-go/blob/49423902a3ca16ac35fa57265f70914d470a964d/opengemini/servers_check.go#L16-L46

c.Ping()函数因网络阻塞时 => 协程无法退出 => checkUpOrDown函数无法停止 => c.endpointsCheck函数将长时间阻塞 => 导致无法接收context.Context停止的信号。

goyjy commented 4 months ago

This is not a problem, there is no scenario that cannot be closed. c.Ping method has a timeout period.

wolfbolin commented 4 months ago

select的操作不合理,ctx.Done()和t.C可能同时满足,case之间是没有顺序的。同时,接收到Ticker的信号后的处理不应该阻塞后续信号的接收。这不满足对于golang的最佳实践。

xuthus5 commented 4 months ago

if ticker.C is executed first, in the next loop, ctx.Done will be executed quickly, which is not a problem. if you have a better optimization solution, welcome to submit PR.

wolfbolin commented 4 months ago

Same usage error #100