天天看點

linux程序挂起的原因6,linux – 如何找出ssh程序挂起的原因?

當我通過ssh運作像iostat -dkx 2 2這樣的指令時,我得到了預期的結果,但是本地計算機上的程序在“可中斷睡眠”狀态下表示活着.為什麼會這樣?有沒有辦法找出這種行為的原因?

完整指令:

$ssh -o ConnectTimeout=4 -o ChallengeResponseAuthentication=no -o PasswordAuthentication=no @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 @ iostat -dkx 2 2

1000 10285 0.0 0.0 103280 904 pts/0 S+ 12:09 0:00 grep 11893

strace的:

$strace -p 11893

Process 11893 attached - interrupt to quit

select(8, [5], [], NULL, NULL^C

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