如何查找ssh进程挂起的原因?

如何查找ssh进程挂起的原因?

当我通过 ssh 运行命令时iostat -dkx 2 2,我得到了预期的结果,但本地计算机上的进程处于“可中断睡眠”状态。为什么会发生这种情况?有没有办法找出这种行为的原因?

完整命令:

$ ssh -o ConnectTimeout=4 -o ChallengeResponseAuthentication=no -o PasswordAuthentication=no <user>@host> iostat -dkx 2 2

ps 输出:

$ ps aux | grep 11893 && ps aux | grep PID
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
1000       10273  0.0  0.0 103280   904 pts/0    S+   12:09   0:00 grep PID
1000       11893  0.0  0.0 158732  3892 ?        S    Feb17   0:00 ssh -o ConnectTimeout=4 -o ChallengeResponseAuthentication=no -o PasswordAuthentication=no <user>@<host> iostat -dkx 2 2
1000       10285  0.0  0.0 103280   904 pts/0    S+   12:09   0:00 grep 11893

跟踪:

$ strace -p 11893
Process 11893 attached - interrupt to quit
select(8, [5], [], NULL, NULL^C <unfinished ...>

wchan:

$ cat /proc/11893/wchan 
poll_schedule_timeout

堆栈跟踪:

$ cat /proc/11893/stack 
[] poll_schedule_timeout+0x39/0x60
[] do_select+0x6bb/0x7c0
[] core_sys_select+0x18a/0x2c0
[] sys_select+0x47/0x110
[] system_call_fastpath+0x16/0x1b
[] 0xffffffffffffffff

相关内容