From e9482b9ebb05d4f23ba1a7faa3b89dd8db84c270 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 29 Jun 2026 11:56:30 +0100 Subject: [PATCH 1/3] test: make TEST-07-PID1.issue-14566 more robust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test slept a fixed 4s after starting the service, then read the child PID from /leakedtestpid. On a loaded host the executor had not exec'd the script yet: [ 1571.079978] TEST-07-PID1.sh[17329]: + systemctl start issue14566-repro [ 1571.079978] TEST-07-PID1.sh[17329]: + sleep 4 [ 1571.079978] TEST-07-PID1.sh[17329]: + systemctl status issue14566-repro [ 1562.350438] systemd[1]: init.scope: Child 17296 belongs to init.scope. [ 1571.081084] TEST-07-PID1.sh[17333]: ● issue14566-repro.service - Issue 14566 Repro [ 1571.081084] TEST-07-PID1.sh[17333]: Loaded: loaded (/usr/lib/systemd/tests/testdata/TEST-07-PID1.units/issue14566-repro.service; static) [ 1571.081084] TEST-07-PID1.sh[17333]: Drop-In: /usr/lib/systemd/system/service.d [ 1571.081084] TEST-07-PID1.sh[17333]: └─10-timeout-abort.conf [ 1571.081084] TEST-07-PID1.sh[17333]: Active: active (running) since Mon 2026-06-29 06:19:07 UTC; 4s ago [ 1571.081084] TEST-07-PID1.sh[17333]: Invocation: b3356aa5fff24eee85e302250ecb06b1 [ 1571.081084] TEST-07-PID1.sh[17333]: Main PID: 17331 (9) [ 1571.081084] TEST-07-PID1.sh[17333]: Tasks: 1 (limit: 4468) [ 1571.081084] TEST-07-PID1.sh[17333]: Memory: 768K (peak: 768K) [ 1571.081084] TEST-07-PID1.sh[17333]: CPU: 1ms [ 1571.081084] TEST-07-PID1.sh[17333]: CGroup: /system.slice/issue14566-repro.service [ 1571.081084] TEST-07-PID1.sh[17333]: └─17331 systemd-executor --deserialize 66 --log-level debug,console:info --log-target journal [ 1562.350492] systemd[1]: Child 17297 ((sd-close)) died (code=exited, status=0/SUCCESS) [ 1571.082379] TEST-07-PID1.sh[17334]: ++ cat /leakedtestpid [ 1571.082379] TEST-07-PID1.sh[17334]: cat: /leakedtestpid: No such file or directory Make the service Type=notify and notify readiness after writing the PID file, and wait for the service to go inactive in a timeout loop instead of fixed sleeps. Follow-up for c1566ef0d22ed786b9ecf4c476e53b8a91e67578 --- .../TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service | 2 ++ .../TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh | 1 + test/units/TEST-07-PID1.issue-14566.sh | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service index 4fd7716081..e285277188 100644 --- a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service +++ b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service @@ -3,6 +3,8 @@ Description=Issue 14566 Repro [Service] +Type=notify +NotifyAccess=all ExecStart=/usr/lib/systemd/tests/testdata/TEST-07-PID1.units/%N.sh ExecStopPost=true KillMode=mixed diff --git a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh index 74fa7605e7..ec0268e891 100755 --- a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh +++ b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh @@ -3,4 +3,5 @@ sleep infinity & echo $! >/leakedtestpid +systemd-notify --ready wait $! diff --git a/test/units/TEST-07-PID1.issue-14566.sh b/test/units/TEST-07-PID1.issue-14566.sh index ecc18e411b..05fade9c4c 100755 --- a/test/units/TEST-07-PID1.issue-14566.sh +++ b/test/units/TEST-07-PID1.issue-14566.sh @@ -14,13 +14,12 @@ if [[ -v ASAN_OPTIONS ]]; then fi systemctl start issue14566-repro -sleep 4 systemctl status issue14566-repro leaked_pid=$(cat /leakedtestpid) systemctl stop issue14566-repro -sleep 4 +timeout 30 bash -c 'while systemctl is-active issue14566-repro; do sleep .5; done' # Leaked PID will still be around if we're buggy. # I personally prefer to see 42. From 682a42891f81cf6346adbcdf6fc4061923777349 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 29 Jun 2026 12:02:41 +0100 Subject: [PATCH 2/3] test: use /run/ for temporary files in TEST-07-PID1.issue-14566 And delete the file before starting, to be safe against reruns Follow-up for c1566ef0d22ed786b9ecf4c476e53b8a91e67578 --- .../TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh | 2 +- test/units/TEST-07-PID1.issue-14566.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh index ec0268e891..6a85ce608f 100755 --- a/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh +++ b/test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.sh @@ -2,6 +2,6 @@ # SPDX-License-Identifier: LGPL-2.1-or-later sleep infinity & -echo $! >/leakedtestpid +echo $! >/run/leakedtestpid systemd-notify --ready wait $! diff --git a/test/units/TEST-07-PID1.issue-14566.sh b/test/units/TEST-07-PID1.issue-14566.sh index 05fade9c4c..66d07bab84 100755 --- a/test/units/TEST-07-PID1.issue-14566.sh +++ b/test/units/TEST-07-PID1.issue-14566.sh @@ -13,10 +13,11 @@ if [[ -v ASAN_OPTIONS ]]; then exit 0 fi +rm -f /run/leakedtestpid systemctl start issue14566-repro systemctl status issue14566-repro -leaked_pid=$(cat /leakedtestpid) +leaked_pid=$(cat /run/leakedtestpid) systemctl stop issue14566-repro timeout 30 bash -c 'while systemctl is-active issue14566-repro; do sleep .5; done' From 58d6d403cedec338ac1b01bdad5cda588ef3d411 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 29 Jun 2026 12:06:28 +0100 Subject: [PATCH 3/3] test: drop ASAN workaround in TEST-07-PID1.issue-14566 https://bugzilla.redhat.com/show_bug.cgi?id=2098125 was marked as fixed some years ago, so it should be safe to run this test again now. Follow-up for 11562ee585d5f2e42cb583f06aa01c7383d85f55 --- test/units/TEST-07-PID1.issue-14566.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/units/TEST-07-PID1.issue-14566.sh b/test/units/TEST-07-PID1.issue-14566.sh index 66d07bab84..ee1021a12e 100755 --- a/test/units/TEST-07-PID1.issue-14566.sh +++ b/test/units/TEST-07-PID1.issue-14566.sh @@ -6,13 +6,6 @@ set -o pipefail # Test that KillMode=mixed does not leave left over processes with ExecStopPost= # Issue: https://github.com/systemd/systemd/issues/14566 -if [[ -v ASAN_OPTIONS ]]; then - # Temporarily skip this test when running with sanitizers due to a deadlock - # See: https://bugzilla.redhat.com/show_bug.cgi?id=2098125 - echo "Sanitizers detected, skipping the test..." - exit 0 -fi - rm -f /run/leakedtestpid systemctl start issue14566-repro systemctl status issue14566-repro