system tests: podman healthcheck flaky, the unhealthy event fires just before the --since window opens
Seen 28 times between 2026-06-04 and 2026-07-30, on both root and rootless, across fedora-prior, fedora-current, rawhide and debian-sid. Almost always the same message.
2026-07-20T17:35:23.6873471Z # [17:31:57.282179556] $ podman exec c-h-t212-ioqzhhpk touch /uh-oh
2026-07-20T17:35:23.6882867Z # [17:32:00.356398465] {"Status":"healthy","FailingStreak":2,"Log":[{...,"ExitCode":0},{...,"ExitCode":0},{...,"ExitCode":1},{...,"ExitCode":1}]}
2026-07-20T17:35:23.6885668Z # libpod-conmon-caa2b7d2b2e8816ca617567f027cf592d28c5073feacb67d110a7796ffd6db27.scope loaded active running
2026-07-20T17:35:23.6888941Z # caa2b7d2b2e8816ca617567f027cf592d28c5073feacb67d110a7796ffd6db27-4d5f2e5e0f0173c3.service loaded active running
2026-07-20T17:35:23.6894234Z # caa2b7d2b2e8816ca617567f027cf592d28c5073feacb67d110a7796ffd6db27-4d5f2e5e0f0173c3.timer loaded active running
2026-07-20T17:35:23.6898492Z # [17:32:00.496967228] $ podman events --filter container=c-h-t212-ioqzhhpk --filter event=health_status --since 2026-07-20T17:32:00,418209571+00:00
2026-07-20T17:35:23.6900599Z # [17:32:01.637147059] $ podman events ...
2026-07-20T17:35:23.6902498Z # [17:32:02.902910416] $ podman events ...
2026-07-20T17:35:23.6904381Z # [17:32:04.294679524] $ podman events ...
2026-07-20T17:35:23.6906274Z # [17:32:05.367194016] $ podman events ...
2026-07-20T17:35:23.6916441Z # [17:32:06.851256665] $ podman events ...
2026-07-20T17:35:23.6918509Z # [17:32:09.634674809] $ podman events ...
2026-07-20T17:35:23.6920611Z # [17:32:10.790602038] $ podman events ...
2026-07-20T17:35:23.6922359Z # #| FAIL: Four or more failures - timed out waiting for 'unhealthy' in podman events
https://github.com/podman-container-tools/podman/actions/runs/29762279833/job/88421964442
A few more: 07-22, 07-21, 07-08, 06-24.
I first assumed the 5s in _check_health was too short, but that is not it - the loop also runs podman events each iteration so it actually waited 10.3s here, and 13.7s in another job. What I cannot explain is the middle of that block: FailingStreak sits at 2 with the timer still active running, and with --health-interval 1s nothing new is recorded for ten seconds. I measured the interval elsewhere in these logs and it is fine, median 1.10s.
Is the healthcheck service expected to keep running after the check starts exiting non-zero? I have only the macOS client here so I could not reproduce it locally.
hey Pual, I hit this again today on an PR, so it is still going on and on.
not ok 212 |220| podman healthcheck in 15635ms
# #| FAIL: Four or more failures - timed out waiting for 'unhealthy' in podman events
https://github.com/podman-container-tools/podman/actions/runs/30463622001/job/91203565547
sys local rootless debian-sid, same wording as the ones above had.
I have submitted a fix for this in #29374.
_check_health in test/system/220-healthcheck.bats previously used a tight 5s timeout (8s when parallel). Under heavy parallel CI load, systemd timers for container healthchecks require longer to execute 3 retries, causing false-positive timeouts while FailingStreak is at 2.
The PR increases the timeout window for $CI / $PARALLEL_JOBSLOT runs to prevent these intermittent timeouts.
Please do not make hurry, this is still in discussion.
and lastly this is primary issues opened so that I can track ongoing failure under same category..
Understood, thanks for pointing that out! I've updated PR #29374 to use Ref #29353 instead of Fixes so this tracking issue remains open for your logs and ongoing discussion.
_check_health in test/system/220-healthcheck.bats previously used a tight 5s timeout (8s when parallel). Under heavy parallel CI load, systemd timers for container healthchecks require longer to execute 3 retries, causing false-positive timeouts while FailingStreak is at 2.
Have you actually checked the logs? The journal contains the logged events and it logged the unhealthy event just fine.
Jul 20 17:32:00 lima-podman-ci podman[152485]: 2026-07-20 17:32:00.350814546 +0000 UTC m=+0.072338363 container health_status caa2b7d2b2e8816ca617567f027cf592d28c5073feacb67d110a7796ffd6db27 (image=quay.io/libpod/testimage:20241011, name=c-h-t212-ioqzhhpk, health_status=unhealthy, health_failing_streak=3, health_log=, created_at=2024-10-11T12:26:00Z, created_by=test/system/build-testimage, io.buildah.version=1.38.0-dev)
If anything the problem is the opposite, the log appears before our since timestamp so we miss it.
you are right, I think I need to recheck this whole once..
@Luap99 rechecked against the journal artifacts, you were right and my title is wrong.
The streak does not stop at 2. Job 88658986341, container c-h-t212-8z85pryk, from journal-sys-local-root-fedora-prior.log:
14:29:15.412347871 healthy streak=0
14:29:15.656128707 healthy streak=0
14:29:16.518557451 healthy streak=1
14:29:19.010015971 healthy streak=2
14:29:20.897162043 unhealthy streak=3
and the --since that _check_health polls with in that job is 2026-07-21T14:29:20,916284157, so the window opens 19 ms after the event it is waiting for.
Same shape on job 89032377003, container c-h-t212-cboduw61: unhealthy at 19:56:46.344191789, and the last --since is 19:56:46,404004262, 60 ms late.
So the 8 to 14 s of polling that follows cannot succeed however long it runs, and raising the timeout would not change that. I will fix the title.
Looking at createTimer in libpod/healthcheck_linux.go, the healthcheck timer is scheduled with --on-unit-inactive, so each run's interval is relative to when the previous run's transient unit exits, not a fixed wall-clock cadence. System tests run via bats -j $(nproc) (Makefile) on an 8-vCPU runner, so up to 8 test files execute fully in parallel with no spare core capacity — which is presumably why _check_health already has a load-aware timeout margin for PARALLEL_JOBSLOT. I don't see any concurrent podman command against this specific container between the "first failure" and "four or more failures" checks (just systemctl queries, which shouldn't touch the container lock), so my guess is a CPU-starved healthcheck run under that 8-way parallel load delays its own process exit — and because the next interval doesn't start counting until that exit, one starved run produces a full ~10s stall rather than gradual drift. Would it make sense to make the timer interval wall-clock-based (e.g. OnCalendar or absolute scheduling) instead of relative to previous-unit-exit, or is that tradeoff intentional? Happy to dig further if useful.
@TanayJalan the ~10s stall was my misreading, corrected above so there is no stall for wall-clock scheduling to fix - what fails is on the test side, the --since is captured after the unhealthy event fires, so the events window can never contain it however the timer is scheduled.
@TanayJalan the ~10s stall was my misreading, corrected above so there is no stall for wall-clock scheduling to fix - what fails is on the test side, the --since is captured after the unhealthy event fires, so the events window can never contain it however the timer is scheduled.
@vtushar06 Thanks, traced it through the actual test now. The race is even tighter than I first thought: _check_health "First failure" (lines 92–97) reads FailingStreak via inspect, accepting any value in [123] in the failing run this shows FailingStreak: 2. Right after that, line 101 re-captures current_time for the next --since, with a comment saying it's there specifically to avoid missing the unhealthy event during the systemctl checks that follow. But since FailingStreak is already 2 when that re-capture happens, only one more failing check is needed to flip to unhealthy and that can fire in the gap between the inspect read and the date call on line 101 (about 62ms in the actual log). So the existing mitigation doesn't cover the one race that actually matters. Would it make sense to just drop the re-capture on line 101 and reuse the original current_time from line 88 (before the failure was even forced) for both checks? That removes the gap entirely since --since would predate every possible transition. Happy to put up a PR for that if it looks right.
Can u please wait before opening any Pr, there is still much thing behind this.
Can u please wait before opening any Pr, there is still much thing behind this. @vtushar06 Understood, thanks — will hold off. Appreciate you flagging #29519, I'll follow along there.