Skip to content

Prevent reload realm barriers from stalling behind retired async work #850

Description

@wieslawsoltes

Problem

The exact full-V8 navigation realm gate stalled on the first top-level replacement while a retired iframe/top-level fetch remained blocked in the host loader. The replacement was accepted, but the fresh realm could not service a trivial binary invocation.

Investigation localized the stall to cancel_detached_frame_context_tasks: erasing a pending fetch destroyed its std::async future while the isolate was held. The future destructor waits for the blocked loader, so cancellation synchronously blocked navigation. Full-realm teardown also built a weak wrapper graph that was immediately discarded later in the same retirement path.

Fix scope

  • cancel retired-context fetches and clear their V8 context/resolver handles without destroying unfinished futures;
  • let the ordinary ready-task drain reap cancelled host loads after completion;
  • during full-realm retirement, run disconnect reactions and register detached roots for native reclamation without building redundant weak wrapper graphs;
  • include the replacement index in barrier diagnostics.

Acceptance

  • all 31 replacement realms complete with the host fetch deliberately blocked;
  • retired timer, fetch, IndexedDB, MessagePort, Worker, and WebSocket callbacks remain absent;
  • storage/cookies survive or isolate according to origin;
  • stale globals/listeners/styles are absent;
  • the first replacement remains below 250 ms and total replacements below 10 seconds;
  • cancelled loads introduce no polling or idle wake loop.

Implementation

Implemented on fix/reload-realm-retirement-850 in commit 9f3fa40f. The focused full-V8 gate completed 31 replacements in 75 ms with unchanged heap and listener counts.

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 workingvscode-oss/mergedMerged for the AppScene/WebScene VS Code OSS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions