28. A healthcheck through ExecSync
28. A healthcheck through ExecSync under runsc¶
Learning goal: whether the warden can run a service's healthcheck in
that service's container through CRI ExecSync under gVisor, with a
timeout that works (design, 'Readiness'). The fallback, if not, is a small
probe container the warden adds to the pod.
Method: spike/compose_pod/main.go hosts, in the same pod and on the
same hosts as experiment 27 (smaug, and the Mac runner's Lima VM), after
its checks. ExecSync calls into the Debian and Alpine containers: exit
codes, /bin/sh -c as Compose's CMD-SHELL would run it, sleep 30 with
a 2 s timeout, a missing binary, and 100 KB of output. After each timed-out
call, the container's process table (read from /proc, since neither
image has ps) is searched for the sleep 30; a last call leaves one
running on purpose, to show the search finds it.
No predictions were written down before the run.
Results (2026-11-30)¶
Identical on smaug and in the Mac VM, apart from timings within 0.05 s:
| Call | Result |
|---|---|
true, false, /bin/sh -c 'echo checking; exit 3' |
exit 0, 1 and 3, stdout checking, in 0.01–0.02 s |
sleep 30, timeout 2 s (Debian and Alpine) |
gRPC DeadlineExceeded after 2.01–2.02 s: failed to exec in container: timeout 2s exceeded: context deadline exceeded |
sleep 30 processes left afterwards |
0 in both containers (the control, a sleep 30 started in the background, counts 1) |
sleep 3, timeout 0 (none) |
exit 0 after 3.02 s |
no-such-binary |
gRPC Unknown: failed to exec in container: failed to start exec "<id>": OCI runtime exec failed: executing processes for container: executing command "no-such-binary" in sandbox: error finding executable "no-such-binary" in PATH [/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]: no such file or directory: unknown |
/bin/sh -c no-such-binary |
exit 127, stderr /bin/sh: 1: no-such-binary: not found |
| 100 KB to stdout | all 100,000 bytes returned |
Experiment 29 adds the case of an image with no shell: in the Spanner
emulator's container, /bin/sh -c true fails with gRPC Unknown ending
executing command "/bin/sh -c true" in sandbox: failed to load /bin/sh: no
such file or directory: unknown.
What we learned¶
ExecSyncis a working healthcheck under runsc. Exit codes and output come back as they would from runc.- Its timeout works and cleans up. The call fails after the timeout to within 20 ms, and the timed-out process is gone from the container.
- A check that can't start is an error, not an exit code. A missing
binary or a missing
/bin/shcomes back as a gRPCUnknowncarrying runsc's text, which names the command and saysno such file or directory; a missing command under a shell is exit 127. The runner can tell "the check failed" from "the check couldn't run" by the error alone. - Output isn't cut short at 100 KB, so the warden has to cap what it passes on (design: a few KiB).
What it changes¶
- The design's 'Readiness' stands: the warden runs a service's check in
its own container through
ExecSync, with the timeout from Compose. - The runner's start failure for an unrunnable check can be told apart by
the
ExecSyncerror, and the design already says it then speaks in allmyram's words rather than passing runsc's text on.