Skip to content

Fix scheduler gather scaling and await wait protocol#345

Open
proboscis wants to merge 1 commit intomainfrom
issue/scheduler-gather-quadratic/run-20260317-110148
Open

Fix scheduler gather scaling and await wait protocol#345
proboscis wants to merge 1 commit intomainfrom
issue/scheduler-gather-quadratic/run-20260317-110148

Conversation

@proboscis
Copy link
Copy Markdown
Owner

Summary

  • deduplicate shared interceptor segment tails so current_interceptor_chain() stops rewalking common caller-chain suffixes
  • keep scheduler wait bookkeeping O(1) with per-wait counters and add a native WaitEffect path
  • align await handling with the CreateExternalPromise -> Wait -> Resume protocol and preserve cooperative sibling cancellation under Gather fail-fast

Verification

  • uvx maturin develop --release
  • uv run pytest tests/core/test_scheduler_transfer.py -q
    • 9 passed in 1.39s
  • uv run pytest tests/core/test_rust_vm_api_strict.py::test_default_handlers_are_module_sentinels_only tests/core/test_sa009_async_handler_spec_gaps.py::TestHandlerImmutabilityContract::test_spawned_child_preserves_full_default_handler_stack tests/effects/test_sync_await_spawn_gather_deadlock.py tests/test_cache_await_spawn_hang.py::TestCacheAwaitSpawnHang::test_no_cache_500_works -q
    • 9 passed in 5.81s
  • uv run python - <<'PY' ... N=500 Spawn+Await+Gather benchmark ... PY
    • N=500 elapsed=3.943s ok=True len=500
  • cargo check --features python_bridge --tests
    • passed in packages/doeff-vm-core

Acceptance Criteria

  • N=500 Spawn+Await(sleep(0.01))+Gather completes well under 10s: 3.943s
  • scheduler regression tests pass, including Gather fail-fast sibling cancellation
  • single-wait Wait now avoids the Gather(single) path, while WaitMode::Any remains O(1)

Refs: scheduler-gather-quadratic

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