Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the goroutine named runtime.gopark?

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:

enter image description here

like image 819
Bat Avatar asked Dec 31 '22 02:12

Bat


1 Answers

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.

like image 53
dlsniper Avatar answered Jan 18 '23 18:01

dlsniper