I am debugging a program written in go via Goland. In the debugger, I can choose between different goroutines that are running. I found alongside my goroutines there is a lot of other goroutines named runtime.gopark and I suspect these are other threads waiting in the thread pool for a job. However, I couldn’t find any answer online. Is that so? If not, what is it actually doing?
P.S. Here is a photo of the incident:
Goroutines are not named. “runtime.gopark” is the package/function where the execution was at the time the debugger stopped the process and took the snapshot of the code execution.
For “runtime.gopark” in particular, this means that the goroutines are temporarily “on hold”, paused by the runtime scheduler.
If you wish to get a better insight into the application, and name the goroutines, then you can use a recent version fo the IDE, like 2020.1.2 (or newer), and annotate the code like described in this article.
Answered By – dlsniper
Answer Checked By – Gilberto Lyons (GoLangFix Admin)