Repository navigation
Retry rename on EACCES - #1386
Merged
Merged
Conversation
ManasJayanth
approved these changes
Jan 5, 2022
Member
|
@aantron Thank you for putting all this effort into figuring the retry limit - something I couldn't get around to doing in #1363 Patch looks good to me as I have tried something similar myself. cc @melwyn95 @EduardoRFS Would one of you like give it another look? |
Contributor
Author
|
I've been using this patched |
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.
This PR retries
renameupon gettingEACCES. I've included data about how many retries are likely necessary.On my system (WSL1 Ubuntu 20.04, omitting hardware details), the
EACCESissue makes it impossible to use esy to install any of the Dream examples or use Dream's quick start. As the data below shows, every installation is expected to fail withEACCES, if it is not worked around.The underlying
EACCESissue seems to be a long-standing problem on WSL1 (microsoft/WSL#1529, microsoft/WSL#3395), and I think we do have to work around it in esy. I'm not sure what is causing theEACCESexactly. I think there are two main classes of possibilities:rename. I think the self-interaction is due to WSL rather than Lwt or another library. Since I compiled esy on WSL, it is using Lwt's Unix (rather than Windows) C code. Since the Unix code seems to work fine on Linux and Mac, this suggests a WSL issue.I built esy with this patch under WSL and ran clean
esy installs in Dream's full-stack ReScript example, using this script:The example was checked out into NTFS. The system was freshly restarted, and VSCode (or anything similar) was not running.
I used a version of this patch with a print showing the number of attempts before
renamesucceeds, and got the following results from 5 runs:Based on this, I naively estimated that if a
renameneeds more than 1 attempt, the number of attempts needed decays by a factor of 4 at each step. I set the limit on the number of attempts naively to 8, thus expecting one failure in about 500esy installattempts of the Dream ReScript example, under all these simplified assumptions.The delay between attempts is (over) one second, so this means that upon legitimate
EACCES, users will have to wait eight seconds to get an error message. I think there are two ways to address this:renamewhenrenamefails. Do we have a recursive copy available in esy or its dependencies? Is it fine to leave the source directory intact?EACCESon WSL, giving users a hint about potential VSCode or other watchers, and what else they can try to solve the problem.Closes #1363.
Probably fixes #1097, some of the reports after the first one.
Probably fixes #1083.
Probably fixes #593, but I haven't looked into non-WSL Windows yet.
Probably fixes camlworks/dream#63.
cc @bryphe, @rizo, @jordwalke, @iMplode-nZ, @a-c-sreedhar-reddy, @srirajshukla, @andreypopp