GO服务 所有协程无法服务。

woaichimian · 2017-02-15 06:41:21 · 6125 次点击

服务停掉,再启动,过段时间还会这样?试试 strace,也可以用 gops 试试

#1
更多评论

现在的感觉是在调度器部分死锁了 gdb进去调试

(gdb) bt
#0  runtime.futex () at /home/xuegeng/go/src/runtime/sys_linux_amd64.s:307
#1  0x000000000042c4e0 in runtime.futexsleep (addr=0x11d3020 , val=0, ns=100000) at /home/xuegeng/go/src/runtime/os1_linux.go:57
#2  0x000000000041103b in runtime.notetsleep_internal (n=0x11d3020 , ns=100000, ~r2=false) at /home/xuegeng/go/src/runtime/lock_futex.go:174
#3  0x000000000041112b in runtime.notetsleep (n=0x11d3020 , ns=100000, ~r2=false) at /home/xuegeng/go/src/runtime/lock_futex.go:194
#4  0x00000000004334ad in runtime.stopTheWorldWithSema () at /home/xuegeng/go/src/runtime/proc.go:963
#5  0x000000000045f419 in runtime.systemstack () at /home/xuegeng/go/src/runtime/asm_amd64.s:291
#6  0x0000000000433870 in runtime.startTheWorldWithSema () at /home/xuegeng/go/src/runtime/proc.go:986
#7  0x000000c82001a000 in ?? ()
#8  0x0000000000000000 in ?? ()

然后strace 时 显示这样 目前GO 版本是1.6 ,debian

[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)
[pid 231942] futex(0x11d3020, FUTEX_WAIT, 0, {0, 100000}) = -1 ETIMEDOUT (Connection timed out)

我试试gops ,感觉是不行的。。

#2

有可能是死循环了,查一下所有的for

#3