Skip to content

mutate: each bounded process watched by its own ticker - #21

Merged
aledbf merged 1 commit into
mainfrom
mutate-bound-per-process
Sep 30, 2026
Merged

aledbf merged 1 commit into
mainfrom
mutate-bound-per-process

Conversation

@aledbf

@aledbf aledbf commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Follows #20, from a KISS/YAGNI review of what the repositories took at 7fefec3.

What changes

  • One watcher per bounded process instead of one shared poller. The poller mutate: every test process held to its share of the memory #20 added started once and never ended, scanned /proc every 100 ms even with nothing running, and needed a registry (map, mutex, sync.Once), a watch type, and a copy of the limit in each watch, which existed only because the goroutine outlived the tests that change memLimit. Now bounded starts a goroutine that ends when Wait returns: it is born with Start and dies with Wait, with no package state. The cost is one /proc scan per process per tick: about 2 ms, a fifth of one core at -j 10, beside the ten test processes it measures.
  • A loop of parents is walked once. /proc is read one process at a time, so a pid reused mid-scan can close a loop A→B→A, which the walk followed for ever while holding the lock. The walk is now treeOf, a pure function with a seen set, and a test with a loop of parents holds it.

The tests from #20 (the mutant stopped, the package as it is let be under the same bound, no test binary left running) are unchanged and pass.

task test (race), task lint and task mutate (7 refused, 0 survived) green locally.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… parents walked once

The one poller every bounded run shared never ended, scanned /proc when nothing ran, and needed a
registry, a mutex and a copy of the limit to outlive the tests that set it. Each run now has a
watcher that starts with the process and ends with its Wait; a scan is a couple of milliseconds,
a fifth of a core at -j 10.

The tree is walked from a snapshot /proc gives a process at a time: a pid reused while it is read
can close a loop of parents, which is now walked once rather than for ever.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aledbf
aledbf merged commit 8ea5167 into main Sep 30, 2026
1 check passed
@aledbf
aledbf deleted the mutate-bound-per-process branch September 30, 2026 22:18
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