Skip to content

setResumingThread assertion fires during iroh exam scenario-2 retries (guest-panic recovery path) #158

Description

@lannbot

Consumer-observed under v0.2.0 while upgrading polymorph-iroh's deltic pin (exam gate just exam-deltic, host-deltic endpoint exam, scenario 2 "relay echo between two endpoint instances").

Observation

Scenario 2 passed on attempt 3 of its retry budget; attempts 1–2 failed with deltic's own invariant assertion rather than the documented guest failure:

AssertionError: two activations claim the resumed ambient at once — the resolve-one-per-turn discipline was violated

(runtime/src/task/scheduler.ts setResumingThread, the M3-A ambient slot.) The run also recorded 2 guest panics from the KNOWN, documented guest-side RefCell borrow hazard (polymorph-iroh host-deltic/src/run-endpoint.ts header: State::drain's borrow held across a block_on yield point — their bug, latent on every host, and the reason the exam has a retry budget at all).

Why it's worth a look

  • The RefCell panic path is the guest aborting with a trap mid-handshake, with other activations of the same instance in flight. The assertion firing there suggests the trap-unwind/poisoning path under jspi can leave/deliver two settled activations racing the ambient claim — a host invariant violation even when triggered by a guest fault.
  • Unknown whether this is new in 0.2.0 or pre-existing but unobserved: scheduler: tick skips threads whose instance is not host-enterable #155 (tick skips non-host-enterable threads) changed scheduler selection immediately before the v0.2.0 cut, and poisoned-instance retirement (host streams: a guest trap strands parked host read/write promises #66-era resumeWith early-return) is exactly the code neighborhood.
  • The exam's retry budget masks it operationally (their gate is green; the 0.2.0 family upgrade landed), so this is not release-blocking — but an assert_ that can fire on a reachable path wants either a repro + fix or a documented downgrade to a defined recovery.

Repro pointer

polymorph-iroh @ the deltic-0.2.0 branch (or main once merged): just setup && just exam-deltic, scenario 2; flaky (attempt-dependent — interleaving of the signing window with parked pollers). A deltic-local repro would be: instance with a parked callback-ABI activation + a second activation that traps mid-block_on-style async import; inspect whether two resumeWith/engine resumptions can both claim the ambient during the unwind.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1Correctness bugs likely to impact consumers; high-priority missing features

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions