[Bug]: youki leaves the container running after a poststart hook fails
Bug Description
A poststart hook exits 7 or exceeds its configured timeout. The runtime reports the hook failure, but the subsequent state query still reports running. The harness terminates the container only in its later cleanup stage.
This report uses OCI Runtime Specification v1.3.0. The historical failure was also observed in the saved failure retest. The attached youki-poststart-failure-leaves-running-reproducer.tar.gz contains the exact case inputs, framework sources and recorded evidence. The exported entry point has only been checked statically, not executed.
Steps to Reproduce
Lifecycle step 9 requires an error, stopping the container, and continuing destruction at step 12. Reporting the hook error without stopping the container does not satisfy this obligation.
Steps to reproduce the issue
Use Linux/WSL2 as root with Python 3, a native C compiler/static libc, and a built runtime. The selected cases declare additional host prerequisites in case.json (for example iproute2/network namespaces or writable cgroup v2 with HugeTLB). Unsupported prerequisites yield SKIP; a failed baseline or valid control is an infrastructure error.
Download the attached youki-poststart-failure-leaves-running-reproducer.tar.gz into a fresh working directory, then extract it and run from the extracted directory:
tar -xzf youki-poststart-failure-leaves-running-reproducer.tar.gz
cd youki-poststart-failure-leaves-running
python3 reproducer/reproduce.py --check-only
sudo python3 reproducer/reproduce.py --runtime /absolute/path/to/youki --output /tmp/youki-poststart-failure-leaves-running-replayThe output directory must be new. Each session uses a private mount namespace, a private runtime state root and a unique container ID. Fixtures and cleanup are the original tested framework code. Network fixtures create their own network namespace and veth; they do not move an existing host interface.
The script builds the static probe, checks the runtime baseline, runs paired controls where present, records the candidate and attempts cleanup. Exit 0 means all selected candidates PASS; 1 means an assertion FAIL was collected; 2 means ERROR/SKIP/incomplete execution. Read report.json and per-session result.json, especially cleanup and prerequisite records. A FAIL from another environment still needs review against the expected behavior above.
The configuration templates in the attachment use ${BUNDLE}, ${RESULT}, ${HOOK}, ${PYTHON} and fixture-specific tokens; the included runner renders them. Do not pass an unrendered template directly to the runtime.
Candidate configurations in the extracted directory:
reproducer/cases/R60-hook-failure/poststart-fail/config.jsonreproducer/cases/R60-hook-failure/poststart-sleep/config.json
youki-poststart-failure-leaves-running-reproducer.tar.gz
Expectation
No response
System and Setup Info
What version of youki are you using?
youki version: 0.7.0
commit: 0.7.0-993a50ffb788be1a1a879f3446c10dd0c0b6a5a1
spec: 1.1.0
rustc: 1.96.0Tested source: 993a50ffb788.
Host OS information
Ubuntu 24.04.1 LTS, x86_64; root; cgroup v2.
Host kernel information
Linux 6.6.114.1-microsoft-standard-WSL2.
Additional Context
No response
Source: youki-dev/youki