Skip to content

docs: teach the runbook the resurrection race and the lifetime-scoping rule#1187

Merged
maartenbreddels merged 1 commit into
masterfrom
docs/leak-runbook-resurrection-race
Jul 7, 2026
Merged

docs: teach the runbook the resurrection race and the lifetime-scoping rule#1187
maartenbreddels merged 1 commit into
masterfrom
docs/leak-runbook-resurrection-race

Conversation

@maartenbreddels

Copy link
Copy Markdown
Contributor

Summary

Answer to "are the runbooks tweaked to find future leaks like this?" — they were half-way: the churn axis and the original use_task case study were already in; this adds what the follow-up episode taught, and removes a rule the handbook was actively teaching wrong.

  • Case study 2 corrected: it ended with the drop-state-before-clear band-aid rule that refactor: give use_task a component-scoped result store instead of cleanup code #1186 deleted again — a future reader would copy the superseded pattern.
  • New case study 3: the resurrection race — its detection signature (rare + never resolves under repeated gc + cleanup clearing storage that workers also write), the self-diagnosing-test recipe that caught it (loop the exact failing config, count anomalously slow passes as hits, dump retainer chains inside the test past a threshold, crank reproduction with parallel pytest processes), the lazy factory-backed accessor trap (Proxy → Singleton.get() re-creating what cleanup just cleared), and the structural rule: scope storage to the owner's lifetime; cleanup code paired with shared registries is a patch, and every patch can race.
  • Checklist step 6b (flaky-leak protocol) and the traps list updated accordingly.

Complements #1186 (the code side of the same lesson). Docs only.

🤖 Generated with Claude Code

…g rule

Case study 2 ended by teaching the drop-state-before-clear band-aid that
the structural fix (#1186) deleted again; a future reader would copy the
wrong pattern. Case study 3 now covers what the follow-up episode taught:
the resurrection-race signature (rare, never resolves under gc, cleanup
clearing storage that workers also write), the self-diagnosing-test
recipe that caught it (dump retainers inside the test past a threshold,
crank reproduction with parallel pytest processes - an anomalously slow
pass is the same hit), the lazy-accessor re-creation trap, and the rule
that makes the whole class of leak disappear: scope storage to its
owner's lifetime instead of pairing shared registries with cleanup code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maartenbreddels maartenbreddels temporarily deployed to docs/leak-runbook-resurrection-race - solara-stable PR #1187 July 7, 2026 09:31 — with Render Destroyed
@maartenbreddels maartenbreddels temporarily deployed to docs/leak-runbook-resurrection-race - solara-stable PR #1187 July 7, 2026 09:31 — with Render Destroyed
@maartenbreddels maartenbreddels merged commit a1efaae into master Jul 7, 2026
31 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