golang应用程序运行时保留了许多线程

时间:2017-11-24 03:54:55

标签: multithreading go goroutine

golang应用程序是一个通过调用c库接收文件,将其保存到磁盘并报告传输状态以使用http协议监视服务的工具。

经过几次转移后,我发现大约有70多个线程存在,并且有几个goroutines。

我查了c并去了源代码,发现没有线程或goroutine泄漏。 我使用" dlv"调试应用程序,这里是其中一个这样的线程的堆栈:

(dlv) bt
0  0x000000000046df03 in runtime.futex
   at /home/vagrant/resource/go/src/runtime/sys_linux_amd64.s:388
1  0x0000000000437e92 in runtime.futexsleep
   at /home/vagrant/resource/go/src/runtime/os_linux.go:45
2  0x000000000041e042 in runtime.notesleep
   at /home/vagrant/resource/go/src/runtime/lock_futex.go:145
3  0x000000000044036d in runtime.stopm
   at /home/vagrant/resource/go/src/runtime/proc.go:1594
4  0x0000000000441178 in runtime.findrunnable
   at /home/vagrant/resource/go/src/runtime/proc.go:2021
5  0x0000000000441cec in runtime.schedule
   at /home/vagrant/resource/go/src/runtime/proc.go:2120
6  0x0000000000442063 in runtime.park_m
   at /home/vagrant/resource/go/src/runtime/proc.go:2183
7  0x0000000000469f1b in runtime.mcall
   at /home/vagrant/resource/go/src/runtime/asm_amd64.s:240

我不知道这些线程来自哪里或者可能是golang运行时的线程池?

任何人都可以看看这个,非常感谢你!

0 个答案:

没有答案