Repository navigation
fix(updates): retry Windows status replacement while a reader holds it - #521
Merged
Merged
Conversation
Windows refuses to rename over a file another process has open without delete sharing. The server polls host update status, the server worker status and upgrade plans while workers rewrite them, so a replacement could fail with EPERM and fail the update. Retry briefly, as self-update-state already does, and never unlink the previous file.
Contributor
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.
Windows CI failed in
lib/hosts/update-worker.test.mjs(#518, attempt 2) with:Windows refuses a rename over a file another process holds open without delete sharing. Host update status, the server worker's status and upgrade plans are polled while workers rewrite them.
self-update-state.atomicWritealready retried; these three writers did not.replaceFileSyncinlib/hosts/update-worker.ts(kept in that file: it is copied standalone to old daemons): on win32 retry EPERM/EACCES/EBUSY up to 20 × 50 ms, never unlink the previous file.writeHostUpdateJson, the server worker's status write andwritePlan.Likely also the cause of the earlier #518 Windows flakes (receipt tests stuck in
running).Verified locally (Linux): typecheck, eslint; update-worker + upgrade-plan + server-update-worker tests 127 pass, 4 skip. The retry branch only runs on Windows CI.
Summary by CodeRabbit