Repository navigation
Discovery.Manager: close sync ch after sender() is stopped - #10218
littlepangdi wants to merge 1 commit into
Conversation
Signed-off-by: liyandi <[email protected]>
8f8ae23 to
bd8709b
Compare
|
Thank you for your pull request. I have been investigating this deeply and this change is not good to me: Prometheus is using this channel into the NotifyManager and the ScrapeManager. Both are reading from this channel. If this channel is closed, they would receive in loops zero-values from that channel. The Prometheus server is using https://github.com/oklog/run to manage those goroutines. This packages does not guarantee any shutdown order, which means that the chances that Notify/Scrape manager might read un-necessarily zeroed values is not nil, leading to unpredictable result. Therefore, I'd prefer to stick to the current behavior. |
|
We have looked at this during our bug scrub. To unblock this, can we maybe use a pattern like |
|
Discussed again at bug-scrub; closing due to lack of progress. |
this PR is to fix #10217 , a possible memory leak when quoating
manager.Sync()outside manager's lifecyclealso see more discuss in grafana/loki#5238
There is a great design for this channel——send ops only happens within goroutine of
sender(),any other place references the channel is via read-mode, see below :prometheus/cmd/prometheus/main.go
Line 1542 in 4cc25c0
so I suggested we can close it after
sender()is stopped naturally( indeferprocess,so there is no worry about sending to a closed channel).