Repository navigation
fix(core): the first open of an execution id holds its turn - #117
Merged
Merged
Conversation
Two opens under one execution id both loaded authority, and the turn went to whichever load finished first. Each load hashes on the libuv thread pool, so the later call sometimes won and the first was refused with execution_in_progress; authority.test.ts failed about one run in 50. The first open now claims the turn before it loads. A second open under the same execution id is refused at once and without a store read, as it already was once the turn was held. Opens without an execution id still load and join as before. The race test now makes the later load finish first, so it fails on the old code every time. A new test frees a turn whose open was cancelled while it loaded.
DaXu999
force-pushed
the
fix/authority-open-race
branch
from
November 8, 2026 15:49
04f45a8 to
6b3d55d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
authority.test.ts, "refuses the later of two opens that race under one execution id", failed about one run in 50 on main. The test was right and the kernel was wrong:openTurnAuthoritylet both opens load authority and gave the turn to whichever load finished first. Each load hashes withcrypto.subtle.digeston the libuv thread pool, so the two can finish in either order, and now and then the later call held the turn while the first was refused withexecution_in_progress. Found while verifying #116.What
docs/api/sharedos-core.mdis regenerated for theopenTurnAuthoritydoc comment. CHANGELOG entry under Fixed.kernel.ts: 22 lines added, 12 removed. Tests: 39 added, 6 removed.Related
Independent of #116; either can merge first.
Checks
pnpm checkis green in a plain clone: format, typecheck, vitest 1156/1156, test:release 7/7,docs:api:checkandconformance:check.kernel.ts, the rewritten race test fails every time.