action #51365
[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)?
History
#2
Updated by pcervinka about 4 years ago
- Assignee set to pcervinka
#3
Updated by pcervinka about 4 years ago
- Status changed from New to In Progress
#4
Updated by pcervinka about 4 years ago
Manually Tested: tail -fn +1 file and there is no lost output. Got inspiration on: https://unix.stackexchange.com/questions/139866/how-do-i-cat-and-follow-a-file.
Changed line in lib/susedistribution.pm:
serial => 'mkfifo /dev/sshserial; tail -f /dev/sshserial',
to
serial => 'mkfifo /dev/sshserial; tail -fn +1 /dev/sshserial',
And it works fine now, all script_output is captured:
http://10.100.12.105/tests/1990#step/kdump_and_crash/5
#6
Updated by pcervinka about 4 years ago
- Target version set to 445
#7
Updated by pcervinka about 4 years ago
- Status changed from In Progress to Resolved
PR merged. Thanks all for the review.
#8
Updated by jlausuch about 4 years ago
- Target version changed from 445 to 457
#9
Updated by pcervinka over 2 years ago
- Target version changed from 457 to QE Kernel Done