Repository navigation
fix(workspace): wait briefly for a held extension lock before refusing a load - #2657
Conversation
391a92f to
05f7112
Compare
05f7112 to
3a79f62
Compare
|
Thanks. The reader collision in #2649 reproduces at the merge-base and the bounded wait fixes it at this head. Three things before it can land:
We will re-review the next push. |
|
All three are in bb9c4d2, a plain commit on top. Materialization now waits through a new async lock acquisition, so the event loop keeps running; the smoke checks a 50 ms interval keeps firing while a load is queued. The pass and writer waits share one deadline, with a smoke cell that refuses at about 1.5 s. The changeset names the pass-guard message first. |
|
Thanks for the second push. The event-loop point from the first round is narrower now but still open, and two smaller things came up on this head:
Both reviews reproduced these through |
|
Pushed |
|
Two independent reviews approved this head (c16f716) with their own reproductions under isolated configuration roots, so the change itself is ready. It cannot be merged as it stands: the pull request now conflicts with Please rebase onto current |
…nt loop The load's bounded wait ran inside the synchronous lock acquisition, which blocked every timer and request for up to five seconds, and the five seconds were granted separately to the pass lock and the writer lock. Add an awaited variant of the acquisition and use it for materialization, with one deadline shared by the pass and writer locks. Correct the changeset to name the pass-lock refusal first and describe the bounded wait in docs/cli.md.
…ing attempt The async lock acquisition called the whole synchronous acquire loop, so a stale writer record behind a live reclaim sentinel still blocked the event loop and ran past the advertised five-second bound. Split one non-blocking try-acquire/reclaim attempt out of acquireLock. It reports both a live holder and a live reclaimer; the sync loop sleeps between attempts and the async one awaits timers under a single deadline. In extension-mutation.ts, keep one pass -> writer policy (parent validation, npm marker refusal, timeout wording, paired releases, error cleanup) and let the sync and async claimers differ only in how they acquire. The async claim no longer carries the parent-borrow branch, which materialization never uses. Correct the docs/cli.md note: a live add, remove or update holds the pass lock too, so the pass-guard message is what a load sees; the install/remove text appears only when the pass is free but the writer is still held. Signed-off-by: drakeo338 <[email protected]>
The lock primitive now lives in @cotal-ai/core, so the async acquirer this change adds ships from core and the changeset names it.
c16f716 to
6c7e8ba
Compare
|
Thanks @drakeo338, this landed in f9a71ce. Loading an installed extension now waits up to five seconds for a held extension lock without blocking the process, instead of refusing at once; we rebased it on main, where the lock code now lives in core. We checked it by reproducing the refusal at the old base and the successful wait at this head, running the extended materialize-concurrency smoke, and typechecking the whole repo merged with current main. |
Fixes #2649.
Loading an installed extension claimed the extension lock with a zero wait, so a
cotalcommand that started a moment before another process finished installing or removing extensions was refused with "extension install/remove is in progress", although a retry would have succeeded. The load now waits up to five seconds for the lock and fails with the same message if the other process is still running after that. I added a changeset and extended the materialize-concurrency smoke test, which fails without the change and passes with it (12 of 12 cells).The maintainers completed this change on the contributor's branch. It is rebased on main, where the advisory lock code now lives in core, so the bounded wait moved there and the changeset lists core too, and the review findings are addressed. Two independent reviewers from different model families approved the exact head below, each with its own reproduction: a load that meets a held extension lock now waits and proceeds once the holder releases, and a lock still held after five seconds is refused with the same messages.
Approved-at: 6c7e8ba