4 ms·
Language support would be great, but could you add logs that record the creating and destruction of goroutines, giving them a unique UUID so you can track which
by jmholla 3y ago
Language support would be great, but could you add logs that record the creating and destruction of goroutines, giving them a unique UUID so you can track which one's haven't exited?
Edit: Also, maybe the tool at this comment could've helped you? https://news.ycombinator.com/item?id=39817775 https://news.ycombinator.com/item?id=39817775
- atombender 3y agoHow 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.
- physicles 3y agoI 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.