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
Commit 0f6912c
Browse filesBrowse the repository at this point in the historyBrowse files
docs: Windows review, bound every retry of the lock loops
The previous amendment bounded only the mkdir path. A dead-owner lock
whose rename keeps failing with EPERM still looped forever: breakLock
swallowed the error, continue went back to mkdir, EEXIST, breakLock,
never reaching the deadline check or the sleep. A persistently failing
stat had the same shape.
W11 now prescribes the deadline check and back-off at the top of every
retry, and reports the last permission error at the deadline. Measured
on Windows: 0 of 24 contention runs fail, and both the deny-create
parent and the rename-denied lock throw after the timeout instead of
spinning.
Copy file name to clipboardExpand all lines: dev-docs/runtime-migration/REVIEW-2026-10-21-windows.md
+49-18Lines changed: 49 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,30 +195,61 @@ Windows consequence, MEASURED with the plans' code extracted verbatim: while one
195
195
196
196
PR 30's own 180-entry test and its "must not flake" Verification would fail on the Windows legs. A flaky test must not be parked in the `windows` known-failures list.
197
197
198
-
**Amendment:** on win32, treat `EPERM`/`EACCES`/`EBUSY` as transient, but only through a bounded retry that checks the deadline and sleeps.
199
-
- Do not simply add these codes next to `EEXIST` in the `mkdir` catch. A *persistent* permission failure (no write access to the lock's parent) then falls through to the `mtime` stat, which finds no lock and `continue`s before both the deadline check and the sleep: a busy loop that never ends. MEASURED on a directory with a deny-create ACL: this version was still spinning after 10 s.
200
-
- The `mkdir` site, in both plans (33's `acquireLock`, 30's `lockIndex` at 633):
if (Date.now() > deadline) throw e; // persistent: report the permission error
198
+
**Amendment:** on win32, treat `EPERM`/`EACCES`/`EBUSY` as transient, and make *every* retry pass the deadline check and the sleep.
199
+
200
+
Two things make a per-site fix unsafe. First, the loop has several `continue` paths that skip the deadline check and the sleep: after a failed `mkdir`, after a `stat` that finds nothing (33's `mtime()` swallows every error; 30:639), and after `breakLock`. Second, a *persistent* permission failure looks just like a transient one. So swallowing these codes at any one site turns a permanent failure into a busy loop that never ends. MEASURED, with the codes swallowed at the sites but the loop otherwise unchanged:
201
+
- a parent directory with a deny-create ACL: still spinning after 10 s (the `mkdir` path);
202
+
- a dead-owner lock whose rename is denied: still spinning after 10 s (`breakLock` → `continue` → `mkdir``EEXIST` → `breakLock`).
203
+
204
+
The loop shape, for 33's `acquireLock` and 30's `lockIndex` alike:
if (alive ===false|| (alive ===undefined&&Date.now() - m > kLockStaleMs)) {
235
+
lastTransient =breakLock(lockDir); // returns the transient error it swallowed, else undefined
212
236
continue;
213
237
}
214
-
if (e.code!=="EEXIST") throw e;
215
238
}
216
-
```
239
+
// ... write the owner marker as in the plan
240
+
}
241
+
```
217
242
218
-
-The read and break sites (`readOwner`, `breakLock`, 30's `stat``continue` at 639): treat the same codes as "not there yet". These paths reach the deadline check and the sleep, or go back to the `mkdir` above, so they stay bounded.
243
+
- `breakLock` returns `undefined` on `ENOENT`, returns the error on a transient code, and throws anything else. In PR 30 the `stat` at 639 treats a transient code like `ENOENT`, recording it in `lastTransient`.
219
244
- Both `rmSync` calls: `{ recursive:true, force:true, maxRetries:10, retryDelay:20 }`.
220
-
- MEASURED for this version (PR 33's lock code, Node 24, 8 processes × 40 acquisitions): 0 of 24 runs failed. On the deny-create directory it throws the `mkdir` permission error once the timeout passes (3 s timeout in the test). PR 30's variant has the same structure; the measurements of an earlier version of this amendment (8/8 and 3/3 clean on Node, 5/5 on Deno) were taken without the bounded `mkdir` branch.
221
-
- Record the rule once in PR 30's lock-ownership contract, since both PRs follow it.
245
+
- Cost: one `kLockRetryMs` sleep after a successful `breakLock`, and after a lock released between `mkdir` and `stat`.
246
+
- MEASURED for this shape (PR 33's lock code, Node 24, 3 s test timeout):
- deny-create parent: throws the `mkdir``EPERM` after the timeout;
249
+
- rename-denied dead-owner lock: throws the `rename``EPERM` after the timeout.
250
+
251
+
PR 30's variant has the same structure. The PR 30 measurements of the first version of this amendment (8/8 and 3/3 clean on Node, 5/5 on Deno) predate this loop shape.
252
+
- Record the rule once in PR 30's lock-ownership contract, since both PRs follow it: "every retry of the acquisition loop passes the deadline check and the back-off; at the deadline, report the last permission error if there was one."
222
253
223
254
### W12 — `gen-tsconfig-paths --check` fails on every Windows checkout
0 commit comments