Add retries to win32 p_unlink and p_open.#3790
Add retries to win32 p_unlink and p_open.#3790carlosmn merged 1 commit intolibgit2:masterlibgit2/libgit2:masterfrom tylerchurch:open-and-unlink-retriestylerchurch/libgit2:open-and-unlink-retriesCopy head branch name to clipboard
Conversation
| break; | ||
| } | ||
|
|
||
| if (errno == EACCES) { |
There was a problem hiding this comment.
When will this be reached? MSDN says that errno is set to EACCES when _wopen returns -1, but the condition above would have caught that case.
There was a problem hiding this comment.
My interpretation of the docs here: https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx was that it could be EACCES, EEXIST, EINVAL, EMFILE, or ENOENT. EACCES was the only one I wanted to retry on, but if you'd like I can kill the conditional and we can just retry no matter the errno.
|
I think use of I seem to remember that we do this retry dance elsewhere in the win32 compat layer. It would be nice to unify the style amongst them (give them a consistent timeout, with a Thanks for starting this, I think it will benefit win32 users quite a bit. |
|
Yeah, a macro would be nice, though so far the usages of the different functions seem just slightly different enough that I'm not sure how useful it would actually be (e.g. p_open needs to return a handle, but p_unlink doesn't.) If you've got an idea for a macro you think would work though, I'm happy to integrate it. I'm with you on adding some global timeout constants. My preference would be for there to be some library wide setting that could be changed by whatever application is loading libgit2, rather than a |
|
I'm not tied to this needing a nice configuration. I think that it's fine to Our globals are set in https://github.com/libgit2/libgit2/blob/master/src/global.c - let me know if you have questions about the patterns in there. |
This pull requests follows the pattern used in this previous pull request: #2211 to add retries to p_unlink and p_open.
When doing checkouts I was seeing Dropbox and/or anti-virus locking files while libgit2 was trying to call p_unlink or p_open. These changes seem to make checkout much more reliable for me on Windows.