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(gatsby): close parcel cache db before clearing cache and retrying #36377

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Aug 12, 2022

Description

Windows crashes hard when you try to move/delete files that are opened. In this case our typescript retry mechanism is causing to hit this issue because Parcel's cache remains alive.

This PR allow us to control the cache life, by passing cache instance explicitly instead of relying on the default. This allows us to close DB connection which removes open handle to db file and allow us to delete those files without errors

Please note that while working on this I discovered some issues with modules that throw on import time. There is runtime parcel require cache that seems to not throw anymore on consecutive imports of problematic modules - instead those are imported as empty objects. In practice it means that we might not show proper errors for this kind of problems, until it's resolved in Parcel

Related Issues

Fixes #36371

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 12, 2022
@pieh pieh added topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 12, 2022
Co-authored-by: Dan Kirkham <herecy@live.co.uk>
Copy link
Contributor

@tyhopp tyhopp left a comment

Choose a reason for hiding this comment

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

Looks good to me! Even after the upstream issue is fixed it's probably useful we have access to our own instantiated cache like this.

There are a couple new failures in the Windows tests after merging in the latest from master that seem legit (do we need to change any of the setup/teardown introduced in #36343?)

Windows tests: https://app.circleci.com/pipelines/github/gatsbyjs/gatsby/85107/workflows/e6e3213c-9150-4498-8686-f7ba94734b08/jobs/1019361

@LekoArts LekoArts merged commit 9d737b6 into master Aug 18, 2022
@LekoArts LekoArts deleted the fix/windows/parcel-recompilation branch August 18, 2022 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parcel error handling masks genuine issues
4 participants