Skip to content

Let ready IO yield to other runnable computations - #1723

Merged
Lorenzobattistela merged 4 commits into
bendlang:mainfrom
oxura:fix/io-fairness-and-js-queues-20261019
Oct 19, 2026
Merged

Lorenzobattistela merged 4 commits into
bendlang:mainfrom
oxura:fix/io-fairness-and-js-queues-20261019

Conversation

@oxura

@oxura oxura commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1719.

A parent could keep issuing ready effects forever without giving its spawned child a turn. Bound a turn to 64 ready effects on C and JS; this does not preempt pure code or cancel losing computations.

Removed the JS queue optimizations following #1644, so #1720 is not addressed here. Runnable arrays and channel queues keep their reference implementation; the requeued runnable record is reused. GUIDE.md is unchanged.

tests/io/chan_try_late.bend held the loop with a run of IO.now reads, which now yields; it holds the loop with one blocking 20 ms foreign effect instead (.c/.js twins), so both timers are still overdue together.

The deterministic progress test prints 73 on Bun and native C. The earlier before/after timeout reproducers remain in #1719.

@oxura oxura changed the title Let ready IO yield without shifting JS channel queues Let ready IO yield to other runnable computations Oct 19, 2026
@Lorenzobattistela Lorenzobattistela self-assigned this Oct 19, 2026
Ready effects now yield every 64 steps, so a loop of IO.now reads no
longer holds the event loop. The sender's 1 ms timer fired mid-hold and
the test deadlocked on every lane. A single 20 ms foreign effect holds
the loop within one turn, so both timers are still overdue together.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lorenzobattistela
Lorenzobattistela merged commit 47af8f7 into bendlang:main Oct 19, 2026
1 check passed
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.

Ready IO effects can starve spawned work and make IO.within miss its deadline

2 participants