goroutine leak from a channel nobody reads from
Go 1.22 here. I've got a worker that sends results on an unbuffered channel, and the caller sometimes returns early on a context timeout. After that the sender goroutine just sits there forever. go tool pprof shows goroutines piling up: 2000+ after a few hours. Reduced version is basically out <- compute() with no receiver. What's the standard fix? I am probably missing something obvious here.
4 replies