Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retry writing traced files if there are conflicts #537

Merged
merged 3 commits into from
Oct 10, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #536

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

It seems that when multiple traced files in the same directory are copied on windows, in some circumstances, we have a race condition which causes a 'resource busy or locked' error. It's possible this is very much an edge case, such as when testing. But this change seems safe; it adds a small 2ms timeout and will retry a file up to 3 times, which will hopefully reduce any flakiness. I've confirmed (with yarn patch) that it does resolve the issue in framework repo.

(Another option would be synchronous file copying.)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added the bug Something isn't working label Sep 30, 2022
@danielroe danielroe requested a review from pi0 September 30, 2022 11:58
@danielroe danielroe self-assigned this Sep 30, 2022
@codecov
Copy link

codecov bot commented Sep 30, 2022

Codecov Report

Merging #537 (36ca9b0) into main (4ce9d82) will decrease coverage by 0.32%.
The diff coverage is 28.57%.

❗ Current head 36ca9b0 differs from pull request most recent head 0b255ee. Consider uploading reports for the commit 0b255ee to get more accurate results

@@            Coverage Diff             @@
##             main     #537      +/-   ##
==========================================
- Coverage   64.08%   63.75%   -0.33%     
==========================================
  Files          55       55              
  Lines        3653     3656       +3     
  Branches      403      404       +1     
==========================================
- Hits         2341     2331      -10     
- Misses       1298     1309      +11     
- Partials       14       16       +2     
Impacted Files Coverage Ξ”
src/rollup/plugins/externals.ts 84.53% <28.57%> (-3.82%) ⬇️
src/build.ts 52.63% <0.00%> (-1.92%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

let error: any
while (retry++ < retries) {
try { return await fn() } catch (err) {
error = err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might always show error as warning. If it is happening too often not hiding the issue.

WinterYukky pushed a commit to WinterYukky/nitro that referenced this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resource busy or locked when copying traced files on windows
2 participants