action #51365
closed[research] Named pipe /dev/sshserial missing lines on first use
0%
Description
I discovered interesting behavior of script_output on spvm backend. When is script_output used for first, few lines at the beginning can be lost.
Here is the openQA reproduction:
- http://10.100.12.105/tests/1978#step/kdump_and_crash/5
script_output is used to get
systemctl status kdump
, but first lines are missing.
# Result:
Process: 4248 ExecStart=/lib/kdump/load.sh --update (code=exited, status=0/SUCCESS)
Main PID: 4248 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/kdump.service
- http://10.100.12.105/tests/1977#step/kdump_and_crash/7
one character was echoed to /dev/sshserial, script_output is used to get
systemctl status kdump
, all lines are captured
# Result:
F0ZS5
● kdump.service - Load kdump kernel and initrd
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2019-05-06 16:37:24 EDT; 13h ago
Process: 4248 ExecStart=/lib/kdump/load.sh --update (code=exited, status=0/SUCCESS)
Main PID: 4248 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/kdump.service
I was able to manually reproduce similar behavior with named pipe on my system. Do it is root to have all output from systemctl,
open first terminal
mkfifo mypipe tail -f mypipe
open second terminal
systemctl status sshd | tee mypipe
Result of first status command, initial lines are missing:
May 08 22:51:43 headcleaner.lan sshd[9215]: Accepted publickey for petr from x.x.x.x port 59408 xxx
May 08 22:51:43 headcleaner.lan sshd[9215]: pam_unix(sshd:session): session opened for user user by (uid=0)
Result of second use of status command:
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-05-06 08:23:50 CEST; 4 days ago
Main PID: 1467 (sshd)
Tasks: 1
Memory: 2.0M
CGroup: /system.slice/sshd.service
└─1467 /usr/sbin/sshd -D
If is reading from named pipe done by cat like, all lines are displayed.
cat mypipe
Maybe, we just need to flush buffer(like write something to it) in pipe before reading from it or maybe update os-autoinst part which reading from /dev/sshserial (in similar way like there is difference between cat and tail)?