Repository navigation
fix: v0.2.2 the launcher no longer hangs inside a container - #4
Conversation
The CPU budget walked the cgroup tree up to /sys/fs/cgroup with dirname and stopped only on an exact match. Inside a container with its own cgroup namespace -- podman's default, and the self-hosted GitHub runner -- the path is "/", so the walk began at "/sys/fs/cgroup/", passed it, reached "/" and dirname'd "/" forever, before any output. trentina's first `sdlc ci` on gloval sat for 30 minutes doing nothing. The walk now ends at the root or anywhere outside it, and reads the root too, which is where a container's own cpu.max lives: a 4-CPU container budgets 2 instead of half the host. tests/contract.sh runs the launcher in a container with a 20-second limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
| # the GitHub runner on gloval -- the path is "/" or climbs with "..". Both | ||
| # mean "the namespace root", which is /sys/fs/cgroup itself, and the root is | ||
| # exactly where a container's quota lives, so it is read, not skipped. | ||
| case "$_dir" in /|*..*) _dir= ;; esac |
There was a problem hiding this comment.
MEDIUM (Bug Hunter): The *..* pattern rejects any cgroup path containing two consecutive dots, not just a .. path component. Cgroup component names can contain consecutive dots, so a valid path such as /system.slice/job..scope is replaced with the namespace root. The walk then misses quotas on that path and can calculate a CPU budget larger than the container's actual limit.
Suggestion: Validate path components individually, rejecting only components that are exactly . or .., while preserving valid names that merely contain consecutive dots.
Evidence:
case "$_dir" in /|*..*) _dir= ;; esac
There was a problem hiding this comment.
fixed in 5b2c33f. Only a .. component (or / itself) now means the namespace root: /, /.., /../*, */../*, */... /system.slice/job..scope is kept as written; checked each case.
`*..*` also matched a legal cgroup name with two dots in it, such as `job..scope`, and would have skipped that path's quota. Gatehouse found it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
There was a problem hiding this comment.
Gatehouse found no issues.
Reviewed 1 commit since 51e7389 (incremental).
Inside a container with its own cgroup namespace the cgroup path is `/`, and the CPU-budget walk never terminated: every command, `--help` included, hung before printing a line. trentina's first `sdlc ci` on the self-hosted runner sat for 30 minutes. The walk now ends at the root or anywhere outside it, and reads the root, which is where a container's quota lives.
🤖 Generated with Claude Code
https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2