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: gracefully ignore unlink errors #9291

Closed
wants to merge 1 commit into from

Conversation

silverwind
Copy link

@silverwind silverwind commented Jul 22, 2022

Description

I'm seeing intermittent build failures relating to deletion of a temporary file vite.config.js.mjs which is generated by loadConfigFromBundledFile:

failed to load config from vite.config.js
error during build:
Error: ENOENT: no such file or directory, unlink 'vite.config.js.mjs'
    at Object.unlinkSync (node:fs:1780:3)
    at loadConfigFromBundledFile (node_modules/vite/dist/node/chunks/dep-1513d487.js:62806:18)
    at async loadConfigFromFile (node_modules/vite/dist/node/chunks/dep-1513d487.js:62692:28)
    at async resolveConfig (node_modules/vite/dist/node/chunks/dep-1513d487.js:62344:28)
    at async doBuild (node_modules/vite/dist/node/chunks/dep-1513d487.js:43308:20)
    at async build (node_modules/vite/dist/node/chunks/dep-1513d487.js:43297:16)
    at async CAC.<anonymous> (node_modules/vite/dist/node/cli.js:747:9)

I'm not sure why it fails exactly, but I'm sure that these unlink errors can be gracefully ignored, which I did here.

What is the purpose of this pull request?

  • Bug fix

@silverwind silverwind changed the title Gracefully ignore unlink errors fix: Gracefully ignore unlink errors Jul 22, 2022
@silverwind silverwind changed the title fix: Gracefully ignore unlink errors fix: gracefully ignore unlink errors Jul 22, 2022
@bluwy
Copy link
Member

bluwy commented Jul 22, 2022

I think this should be fixed in #9224. Are you running builds/dev in parallel?

@silverwind
Copy link
Author

Yes, it's possible that they run in parallel, so it looks to be a race condition as it does not happen every time.

@silverwind
Copy link
Author

Linked fix should work, but it could still fail if both files are written in the same millisecond, so I guess that fix here may still be valuable.

@bluwy
Copy link
Member

bluwy commented Jul 22, 2022

I doubt there's a chance both files are writing within the same millisecond. We're running async code above so there's a lot of variability. try..catch imposes a small perf implication too so if we can avoid it then I think it's better.

@silverwind
Copy link
Author

silverwind commented Jul 22, 2022

Okay, I will wait for next release then to verify the fix.

@silverwind silverwind closed this Jul 22, 2022
@silverwind silverwind deleted the graceful-unlink branch July 22, 2022 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants