当请求压缩时,ansible openssh 服务器会挂起,cpu 占用 100% ( ssh -C
)
ssh -vvv -C root@host
[...]
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).
Authenticated to host
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: proc
然后客户端挂起(不再对 ctrl-c 做出反应)并且服务器有一个 CPU 占用率为 100% 的进程(但接受新的 ssh 连接)。
客户端上的 strace 结束于:
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 -opost -isig -icanon -echo ...}) = 0
ioctl(0, TCGETS, {B38400 -opost -isig -icanon -echo ...}) = 0
clock_gettime(CLOCK_BOOTTIME, {tv_sec=337152, tv_nsec=214378998}) = 0
clock_gettime(CLOCK_BOOTTIME, {tv_sec=337152, tv_nsec=214391217}) = 0
select(9, [5], [4], NULL, {tv_sec=300, tv_usec=0}) = 1 (out [4], left {tv_sec=299, tv_usec=999998})
clock_gettime(CLOCK_BOOTTIME, {tv_sec=337152, tv_nsec=214421550}) = 0
write(4, "\302rv\230\347\310G\357T\204\272\3\27\1\341aE\20\317\233\374>\234\217&\0#g\241\225U\215"..., 112) = 112
clock_gettime(CLOCK_BOOTTIME, {tv_sec=337152, tv_nsec=214447208}) = 0
clock_gettime(CLOCK_BOOTTIME, {tv_sec=337152, tv_nsec=214457769}) = 0
select(9, [5], [], NULL, {tv_sec=300, tv_usec=0}
在服务器上进行 Strace:一旦进程挂起,连接到strace -p
挂起的进程将不再显示任何内容。连接到主进程时,连接时会显示:
Process 257 attached
select(7, [3 4], NULL, NULL, NULL) = 1 (in [3])
accept(3, {sa_family=AF_INET, sin_port=htons(43604), sin_addr=inet_addr("192.168.100.1")}, [16]) = 5
fcntl(5, F_GETFL) = 0x2 (flags O_RDWR)
pipe([6, 7]) = 0
socketpair(PF_LOCAL, SOCK_STREAM, 0, [8, 9]) = 0
rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
fork() = 821
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
close(7) = 0
write(8, "\0\0\0\366\0", 5) = 5
write(8, "\0\0\0\355\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"..., 245) = 245
close(8) = 0
close(9) = 0
close(5) = 0
getpid() = 257
getpid() = 257
getpid() = 257
select(7, [3 4 6], NULL, NULL, NULL) = 1 (in [6])
close(6) = 0
select(7, [3 4], NULL, NULL, NULL
此后,直到下一个(挂起的)连接才会再产生相同的输出。
答案1
似乎是一个已知错误Alpine Linux 中的 openssh。