Repository navigation
Launcher: the shared-folder cleanup never collides with an earlier cleanup; bounded retries - #53
Merged
Merged
Conversation
…eanup; bounded retries
StartCleanup moves %LOCALAPPDATA%\WrongGPU aside and lets a hidden cmd.exe delete
it. The target name was <folder>.cleanup-<pid>-<GetTickCount64()>; that clock
moves in steps of about 16 ms, so a second cleanup of the same folder within one
step (an install's restore followed by the last game's uninstall, or Remove data
right after an uninstall) aimed at the first cleanup's folder, which is deleted
only seconds later. The move failed with error 183 and the folder was left in
place ("cleanup deferred").
- The target name adds a process-wide sequence number and is checked free first.
- A sharing violation (32) or an access denied (5: how a folder rename fails while
another program, such as a scanner, has a just-written file in it open) is tried
again, at most 5 times with waits from 50 ms doubling, each wait logged with the
error. Any other error is final; the deferred line now names the error.
- Test seam SetCleanupMoveForTest (record.h).
Tests (wg-core, every build): two cleanups of one folder back to back, 20 runs;
error 5 for 3 tries then success; error 5 every time (5 tries, folder left,
deferred line names the error); error 32 twice then success; error 183 once
(deferred at once).
Split out of #46 at review.
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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.
Split out of #46 at review: the shared-folder cleanup fix on its own.
StartCleanupmoves%LOCALAPPDATA%\WrongGPUaside and lets a hiddencmd.exedelete it. The target name was<folder>.cleanup-<pid>-<GetTickCount64()>; that clock moves in steps of about 16 ms, so a second cleanup of the samefolder within one step (an install's restore followed by the last game's uninstall, or Remove data right after an
uninstall) aimed at the first cleanup's folder, which is deleted only seconds later. The move failed with error 183
and the folder was left in place ("Shared data cleanup deferred").
scanner, has a just-written file in it open) is tried again, at most 5 times with waits from 50 ms doubling, each
wait logged with the error. Any other error is final; the deferred line now names the error.
SetCleanupMoveForTest(record.h).Tested (launcher core CPU tests in the CI configuration, on c793823: source-size, wording, wg-core,
launcher-core, coexist-core pass, 0 compiler warnings; line-ending check). wg-core's new cases, run directly:
Not tested