Skip to content

fix: v0.2.2 the launcher no longer hangs inside a container - #4

Merged
fatherlinux merged 2 commits into
mainfrom
fix/cgroup-walk-in-container
Nov 4, 2026
Merged

fatherlinux merged 2 commits into
mainfrom
fix/cgroup-walk-in-container

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

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.

  • Reproduced in a Fedora container: `sdlc --help` timed out before, exits 0 after
  • A `--cpus 4` container budgets 2; the 14-core host budgets 7
  • `tests/contract.sh` now runs the launcher in a container with a 20 s limit

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found 1 issues (1 medium)

Full review.

1 finding(s) dropped: their evidence is not in the diff.

Comment thread bin/sdlc Outdated
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found no issues.

Reviewed 1 commit since 51e7389 (incremental).

@fatherlinux
fatherlinux merged commit ed02ca6 into main Nov 4, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant