Re:The Case of a Leaky Goroutine
by atombender on Monday March 25, 2024 @07:57PM
(#39822684)
How would one log that? In our case the bug was in a goroutine started by a third-party library, so we don't have control over when it starts or exits.
I don't think Goleak would have helped here, because I believe it doesn't support concurrency. It's really designed to run in tests, not in production. It parses and searches stack traces, so it's not going to be performant.
I guess you’d need to fork the third-party library (or, if you can build locally, just yolo and chmod +w) and inject something to track those goroutine metrics. But I suppose by the time you’re doing that, you already know where the problem is.
Edit: Also, maybe the tool at this comment could've helped you? https://news.ycombinator.com/item?id=39817775