Skip to content

Runtime: a spawn past the live-task limit stops loudly instead of returning a fiber id of -1 (#995) - #2688

Merged
ehartford merged 1 commit into
fix-996from
fix-995
Oct 25, 2026
Merged

ehartford merged 1 commit into
fix-996from
fix-995

Conversation

@ehartford

@ehartford ehartford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: with_fiber_spawn (rt/fiber_core_darwin.w, rt/fiber_core_windows.w)
returned -1 when MAX_FIBERS tasks were live; every spawn site codegen emits
stored it as the Task's fiber id unchecked, and awaiting that Task returned
at once with a result buffer no fiber wrote. 1100 sleeping tasks awaited to
1024 right answers and zeros.

The spawn panics: "spawn: as many tasks are running as one program holds at
once (MAX_FIBERS); await some before spawning more". Whether the table
should grow instead is a separate question; the failure is no longer
silent.

Test: test/behavior/behav_995_spawn_past_live_task_limit.w (1100 tasks that
sleep; exit 134; the installed compiler prints 0 and exits 0).

Closes #995

@ehartford
ehartford added this pull request to stack #2689 October 25, 2026 23:07
@ehartford ehartford changed the title fix 995 Runtime: a spawn past the live-task limit stops loudly instead of returning a fiber id of -1 (#995) Oct 25, 2026
…urning a fiber id of -1 (#995)

Root cause: with_fiber_spawn (rt/fiber_core_darwin.w, rt/fiber_core_windows.w)
returned -1 when MAX_FIBERS tasks were live; every spawn site codegen emits
stored it as the Task's fiber id unchecked, and awaiting that Task returned
at once with a result buffer no fiber wrote. 1100 sleeping tasks awaited to
1024 right answers and zeros.

The spawn panics: "spawn: as many tasks are running as one program holds at
once (MAX_FIBERS); await some before spawning more". Whether the table
should grow instead is a separate question; the failure is no longer
silent.

Test: test/behavior/behav_995_spawn_past_live_task_limit.w (1100 tasks that
sleep; exit 134; the installed compiler prints 0 and exits 0).
@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven battery green on the stack top 4c3aa21 (pinned seed nightly-20261025-local-1-c88f3eeff0bc): gate green, uat green, survey: all targets green.

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.

Spawning >1024 live fibers silently yields Tasks that await to zero (unchecked -1 fiber_id)

1 participant