gomega icon indicating copy to clipboard operation
gomega copied to clipboard

`work` channel in `gmeasure.Experiment.Sample` is not closed upon return

Open davidhsingyuchen opened this issue 2 years ago • 4 comments

My understanding is that the goruotines will still be waiting on range work even after Example.Sample returns, and the fact that those goroutines are still referencing the work channel may further prevent the channel itself from being garbage collected. Please let me know if I'm missing anything, thanks!

davidhsingyuchen avatar Aug 27 '22 20:08 davidhsingyuchen

oh hey - sorry for the delay. that's a good catch. we need to close the work channel.

onsi avatar Sep 19 '22 17:09 onsi

cough gleak 😁

thediveo avatar Sep 19 '22 17:09 thediveo

In fact! https://github.com/onsi/gomega/commit/119d4cea3d32068752e4285e256e231d9748757a and https://github.com/onsi/gomega/commit/8c54344b7bc6a1091fe7f1b674ae1cb9cccc850a

Super satisfying :)

onsi avatar Sep 19 '22 17:09 onsi

...it just caught me these days leaking worker pools. Not that I'm not full of good intentions to not leak, yet ... well, you know...

thediveo avatar Sep 19 '22 17:09 thediveo