Subject: stdout overwriting logger output for service units To: poky@lists.yoctoproject.org From: jcmalek@lakeheadu.ca X-Originating-Location: Montreal, Quebec, CA (129.222.205.229) X-Originating-Platform: Windows Chrome 107 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Wed, 23 Nov 2022 09:08:40 -0800 Message-ID: Content-Type: multipart/alternative; boundary="xfvrhplBZRYcNIwtP35T" --xfvrhplBZRYcNIwtP35T Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi there Poky team, I have recently noticed that some of the stdout output has been overwriting= the logger output when I do a "journalctl -u service_name" on any of the s= ervices. The systemd team has referred me to this project (my downstream di= stro) to look into the issue before they are willing to have a look. They w= ould ideally like this tested on a newer version of systemd. The steps to r= eproduce the problem are fairly simple. I have hopefully included all the r= elevant details below. Please let me know if there is anything else you nee= d. systemd version the issue has been seen with -------------------------------------------- 246 Used distribution ----------------- Poky (Yocto Project Reference Distro) 3.2.4 \n \l Linux kernel version used ------------------------- 5.12.10 CPU architectures issue was seen on ----------------------------------- arm Component --------- journalctl Expected behaviour you didn't see --------------------------------- Expected both logger and standard output to appear in service unit logs: journalctl -f -u test Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 1 Nov 16 15:05:08 c-00012 root[1650]: Logger: 1 Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 2 Nov 16 15:05:08 c-00012 root[1652]: Logger: 2 Nov 16 15:05:09 c-00012 sh[1617]: Standard output: 3 Nov 16 15:05:09 c-00012 root[1654]: Logger: 3 Nov 16 15:05:10 c-00012 sh[1617]: Standard output: 4 Nov 16 15:05:10 c-00012 root[1656]: Logger: 4 Nov 16 15:05:11 c-00012 sh[1617]: Standard output: 5 Nov 16 15:05:11 c-00012 root[1658]: Logger: 5 Unexpected behaviour you saw ---------------------------- I only get the standard output messages and every once and a while one of t= he logger messages sneaks through: journalctl -f -u test Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 1 Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 2 Nov 16 15:05:09 c-00012 sh[1617]: Standard output: 3 Nov 16 15:06:09 c-00012 root[1654]: Logger: 3 Nov 16 15:05:10 c-00012 sh[1617]: Standard output: 4 Nov 16 15:05:11 c-00012 sh[1617]: Standard output: 5 Steps to reproduce the problem ------------------------------ test.service contents: [Unit] Description=3DTest DefaultDependencies=3Dno [Service] Type=3Doneshot ExecStart=3D/bin/sh /mytest.sh RemainAfterExit=3Dyes /mytest.sh contents: #!/bin/sh i=3D0 while [ $i -le 100 ]; do echo "Standard output: ${i}" logger "Logger: ${i}" sleep 1 i=3D$((i+1)) done * journalctl -f -u test * systemctl start test --xfvrhplBZRYcNIwtP35T Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
= Hi there Poky team,

I have recently noticed that some of the stdout output has been overwrit= ing the logger output when I do a "journalctl -u service_name" on any of th= e services. The systemd team has referred me to this project (my downstream= distro) to look into the issue before they are willing to have a look. The= y would ideally like this tested on a newer version of systemd. The steps t= o reproduce the problem are fairly simple. I have hopefully included all th= e relevant details below. Please let me know if there is anything else you = need.

 

systemd version the issue has been seen with

246

Used distribution

Poky (Yocto Project = Reference Distro) 3.2.4 \n \l

Linux kernel version used

5.12.10

CPU architectures issue was seen on

arm

Component

journalctl

Expected behaviour you didn't see

Expected both logger= and standard output to appear in service unit logs:

journalctl -f -u tes= t
Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 1
Nov 16 15:= 05:08 c-00012 root[1650]: Logger: 1
Nov 16 15:05:08 c-00012 sh[1617]: = Standard output: 2
Nov 16 15:05:08 c-00012 root[1652]: Logger: 2
= Nov 16 15:05:09 c-00012 sh[1617]: Standard output: 3
Nov 16 15:05:09 c= -00012 root[1654]: Logger: 3
Nov 16 15:05:10 c-00012 sh[1617]: Standar= d output: 4
Nov 16 15:05:10 c-00012 root[1656]: Logger: 4
Nov 16 = 15:05:11 c-00012 sh[1617]: Standard output: 5
Nov 16 15:05:11 c-00012 = root[1658]: Logger: 5

Unexpected behaviour you saw

I only get the stand= ard output messages and every once and a while one of the logger messages s= neaks through:

journalctl -f -u tes= t
Nov 16 15:05:08 c-00012 sh[1617]: Standard output: 1
Nov 16 15:= 05:08 c-00012 sh[1617]: Standard output: 2
Nov 16 15:05:09 c-00012 sh[= 1617]: Standard output: 3
Nov 16 15:06:09 c-00012 root[1654]: Logger: = 3
Nov 16 15:05:10 c-00012 sh[1617]: Standard output: 4
Nov 16 15:= 05:11 c-00012 sh[1617]: Standard output: 5

Steps to reproduce the problem

test.service content= s:

[Unit]
Description=3DTest
DefaultDependencies=3Dno


[Service]
Type=3Doneshot
ExecStart=3D/bin/sh /mytest.sh
RemainAfterExit=3Dyes

/mytest.sh contents:=

#!/bin/sh
i=3D0
while [ $i -le 100 ]; do
  echo "Standard output: ${i}"
  logger "Logger: ${i}"
  sleep 1
  i=3D$((i+1))
done
  1. journalctl -f -u test
  2. systemctl start test
--xfvrhplBZRYcNIwtP35T--