Skip to content

fix(observer): stop panicking on transient OS state - #1916

Closed
blt wants to merge 2 commits into
blt/throttle-hardeningfrom
blt/observer-hardening
Closed

fix(observer): stop panicking on transient OS state#1916
blt wants to merge 2 commits into
blt/throttle-hardeningfrom
blt/observer-hardening

Conversation

@blt

@blt blt commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Related issues

A list of issues either fixed, containing architectural discussions, otherwise relevant
for this Pull Request.

Additional Notes

Anything else we should know when reviewing?

blt added 2 commits July 21, 2026 20:39
Under panic=abort, several transient conditions in the observer aborted the
whole run, which ADR-004 forbids. The stat sampler skips a stale /proc/<pid>/stat
sample after PID reuse instead of asserting, and parses cgroup cpu.max with a
bounds-checked helper that returns an error rather than indexing past a truncated
read. Descendant listing yields an empty iterator when a target process vanishes
instead of unwrapping into a panic. The sample loop treats a procfs, cgroup, or
wss read failure as best-effort, logging and skipping that component rather than
killing the experiment.
…comm

parse(/proc/<pid>/stat) sliced &contents[end_paren + 2..] on the routine
per-process CPU-sampling path, assuming two bytes follow the comm's
closing ')'. A read truncated at the ')' -- the same transient short-read
this commit's sibling guards already defend against -- made that slice
panic, aborting the whole run under panic=abort (ADR-004). Use a
bounds-checked get() that returns Error::StatMalformed instead, and add a
test driving truncated inputs.

blt commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

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