8000 Fix tap interface numbering by trungams · Pull Request #16 · citelab/gini · GitHub
[go: up one dir, main page]

Skip to content

Fix tap interface numbering - #16

Merged
anrl merged 2 commits into
masterfrom
issue-5
Dec 29, 2018
Merged

anrl merged 2 commits into
masterfrom
issue-5

Conversation

@trungams
Copy link
Copy Markdown
Member

Use a dictionary to map router-switch pairs to corresponding tap name.
This should allow for larger network topologies

Use a dict to map router, switch pairs to corresponding tap name
This way tap numbering can start increasing from 0
@anrl
anrl merged commit fb8d81c into master Dec 29, 2018
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
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.

2 participants

0