Closed JeffreyDevloo closed 8 years ago
Can your create a PR for this?
from ovs.extensions.generic.sshclient import SSHClient
client = SSHClient('10.100.199.152', 'root')
client.run('lsof')
The lsof was one of the commands that always hung when started.
Got the output from command as expected.
u"COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME\ninit 1 root cwd DIR 252,0 4096 2 /\ninit 1 root rtd DIR 252,0 4096 2 /\ninit 1 root txt REG 252,0 265848 260233 /sbin/init\ninit 1 root mem REG 252,0 43616 390375 /lib/x86_64-linux-gnu/libnss_files-2.19.so\ninit 1 root mem REG 252,0 47760 390379 /lib/x86_64-linux-gnu/libnss_nis-2.19.so\ninit 1 root mem REG 252,0 97296 390369 /lib/x86_64-linux-gnu/libnsl-2.19.so\ninit 1 root mem REG 252,0 39824 390371 /lib/x86_64-linux-gnu/libnss_compat-2.19.so\ninit 1 root mem REG 252,0 14664 390332 /lib/x86_64-linux-gnu/libdl-2.19.so\ninit 1 root mem REG 252,0 252032 390391 /lib/x86_64-linux-gnu/libpcre.so.3.13.1\ninit 1 root mem REG 252,0 141574 390406 /lib/x86_64-linux-gnu/libpthread-2.19.so\ninit 1 root mem REG 252,0 1840928 390316 /lib/x86_64-linux-gnu/libc-2.19.so\ninit 1 root mem REG
Test passed.
Problem description
The SSHClient.run can and will hang forever on large outputs.
Possible root of the problem
The run method in SSHClient reads the whole stdout in a single go. The issue is, is that this buffer can overflow if a large output from a command is expected.
Possible solution
Read stdout partially.
Additional information
Setup
Hyperconverged setup
Package information