parallel: a panicking windows body on a helper worker must not hang the join #258
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
A panic in a
windowsbody on a helper worker must not hang the join: today the owner of the region spins intorb_region_joinforever.Context
Split out of #253 (follow-up of #4 / PR #248, merged as
f9b867d0, disclosed there). Located onmain:std/parallel/src/lib.trbwindowsTakenclaims a window (claimWindow), runsbody, then callsfinishWindow. A panic inbodyskipsfinishWindow.runtime/task.ctorb_region_joinwaits untilfinished >= next. A claimed window that never finishes keepsfinished < next, so the join yields in a loop without end.torb_resume_recovered/torb_task_panicked,runtime/task.c~1050-1095) a helper that panics is completed as cancelled and its frames are gone, so nothing ever finishes its window. Outside a test the panic ends the process, so only the harness case hangs. A panic in the owner's ownwindowsTakenunwinds pastjoinRegionand leaks the region slot (no hang, but helpers keep running against a region nobody joins).Design (decide in the PR, runtime only)
Account the in-flight claim to the task that holds it:
torb_region_claimrecords the claiming task/worker in the region, andtorb_task_panickedcalls a newtorb_region_abandon(task)that counts the window as finished (and the owner side of a recovered panic closes the region), so the join ends and the test reports the panic as its failure. No new native and no signature change:claimWindow,finishWindow,joinRegionstay as declared instd/parallel/src/lib.trb.Acceptance criteria
windowsbody on a helper worker ends the join; the test fails with the body's panic message instead of hanging (runtime/tests/pool_test.c:region_helper_panic_ends_join, with a timeout guard so a regression fails and does not hang CI).windowscall in the same test run works (region_owner_panic_frees_slot).finishedcount when a task panics afterfinishWindow(region_panic_after_finish_counts_once).Dependencies
#4 (PR #248) is merged; none open. Independent of the generation-check issue.
Seed
None. Runtime-only change in
runtime/task.c; no syntax, no new native, no std name looked up by the compiler.Risk
Medium-low. Touches the panic path of the pool, which runs only under a test harness. The accounting must not double-count a window (join would end early while a body still writes). Keep the abandon under the region lock.
[loop:torbscript] refine: both problems located on main by reading runtime/task.c and std/parallel. Generation check missing in torb_region_get/set (this issue); panic in a helper body skips finishWindow so torb_region_join spins forever (split into #258). Seed impact: none for both (runtime only). Criteria, tests, risk in the body. next: ready
[loop:torbscript] claim implement by session:loop-torbscript-20261009 until 2026-10-09T13:55Z
windowsends the join #260[loop:torbscript] close: PR #260 (a recovered panic in a window of
windowsends the join) approved and merged by argus (merge commitf717f823), issue closed. Claim released.