Repository navigation
Conversation
Use a dict to map router, switch pairs to corresponding tap name This way tap numbering can start increasing from 0
anrl
added a commit
that referenced
this pull request
Sep 9, 2026
Found auditing the Traps & Interrupts Lab. TrapLab fired-and-forgot its poll and catch threads, guarding only with `if not self._closed` before the emit. That guard is check-then-act: a worker already past it can emit into a dialog being destroyed. Two ways to die — a deleteLater() path destroys the dialog under the in-flight emit, or the worker's closure over `self` is the LAST reference and the QObject is destroyed ON the worker thread when the closure dies. Both undefined in Qt, both a segfault, nondeterministic, which is why it hid. Not just a test artifact. MachineLab._retire() runs setParent(None) + deleteLater() after looking up stop_polling() — and TrapLab never had one, so the join the rest of the codebase relies on was silently skipped. Re-opening the Traps card, or closing the Machine Lab with a catch in flight, was a gBuilder segfault path. Root-caused by isolation rather than inspection: making every worker synchronous (no production change) took the crash from 1-2 per 20 two-module test runs to 0/20, and the fatal trace put the main thread in the Qt event flush with a worker mid-emit(). The pre-change test file crashes at the same rate, so it is pre-existing, not introduced by the recent journey work. Fix reuses the remedy already in the tree for the Memory and File System faces: - TrapLab adopts LivePollMixin — _closed set FIRST, worker joined in stop_polling(), which closeEvent calls and _retire() now finds. - The one-shot catch worker can block for the agent's whole wait (~10s), too long for a full join, so it holds a weakref to the dialog plus a bounded join: a straggler can neither emit into a dead dialog nor become its last owner. - _fetch/_apply become the mixin's _read/_render_live, which also gets the Traps face backoff and "a bad read never blanks a good picture" for free. Verified three ways: 0/40 crashes on the pair that failed 1-2 in 20; the production _retire-mid-catch path observed to block for the catch's duration (it joins) and survive with zero leaked threads; and a new regression test the suite-wide _no_leaked_threads fixture enforces. Full suite green: 3336 passed. Documented as known issue #17 — rewritten from a MachineLab-specific note into the CLASS of bug, since ~18 UI files carry the same shape (machine_lab, main_window, router_lab, inspector, assistant, ...). It needs three ingredients to crash and most dialogs are Qt-parented, which is why it was not an epidemic; the entry has the mechanism, the proof, a census, and the rule for new faces. live_poll.py points at it, since that is where someone adding a background read will be reading. The face-by-face sweep is deliberately NOT bundled here. Also records the audit findings elected to skip (#12-#16): the single-threaded agent stall, the catch probe being itself a device interrupt (accurate trap, inaccurate attribution), the full-ring dump per poll, three memory-ordering nits moot on QEMU, and the kernel-mode/bystander narration deferred with C-11. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUSXZZotxcPLhjvgvQwZnY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use a dictionary to map router-switch pairs to corresponding tap name.
This should allow for larger network topologies