You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[JS/TS] Async.StartChild with a timeout doesn't cancel the child #5093
When the timeout passed to Async.StartChild expires on the JS target, the TimeoutException is raised as it should be, but the child computation carries on running to completion. On .NET the child is cancelled, and the Python target was changed to do the same in #5035. (#4481 fixed the opposite problem, where the timeout always fired, so this is the part that's left.)
startChild in Async.ts starts the child on the parent's token and races it against a setTimeout; when the timeout wins the race rejects, but nothing cancels the child.
The existing test, "Async.StartChild applies timeout" in tests/Js/Main/AsyncTests.fs, can't catch this, because the child sleeps for 1,000ms but the test checks x straight after the 200ms timeout, before the child would have appended "X". Waiting past the child's sleep before the equal would catch it.
Possible fix
Start the child on its own token, linked to the parent's so that cancelling the parent still cancels the child, and cancel that token when the timeout fires.
Activity
fix(js/ts): cancel the child when the Async.StartChild timeout expires
MangelMaxime commentedon Oct 21, 2026
Fixed by #5097, available in the next release.