Project

General

Profile

Actions

action #51365

closed

[research] Named pipe /dev/sshserial missing lines on first use

Added by pcervinka almost 5 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Spike/Research
Target version:
QE Kernel - QE Kernel Done
Start date:
2019-05-10
Due date:
% Done:

0%

Estimated time:
Difficulty:

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:

# 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
# 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)?

Actions #2

Updated by pcervinka almost 5 years ago

  • Assignee set to pcervinka
Actions #3

Updated by pcervinka almost 5 years ago

  • Status changed from New to In Progress
Actions #4

Updated by pcervinka almost 5 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

Actions #6

Updated by pcervinka almost 5 years ago

  • Target version set to 445
Actions #7

Updated by pcervinka almost 5 years ago

  • Status changed from In Progress to Resolved

PR merged. Thanks all for the review.

Actions #8

Updated by jlausuch almost 5 years ago

  • Target version changed from 445 to 457
Actions #9

Updated by pcervinka over 3 years ago

  • Target version changed from 457 to QE Kernel Done
Actions

Also available in: Atom PDF