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(core): atomic writes of nxdeps.json #12920

Merged
merged 1 commit into from Nov 17, 2022

Conversation

jonhamm
Copy link
Contributor

@jonhamm jonhamm commented Nov 1, 2022

Current Behavior

The issue #9146 describes how Nx will now and then experience errors because of invalid nxdeps.json file.

Expected Behavior

When writing nxdeps.json prevent parallel processes from seing half-written files and prevent half written files to be left in case of process crash tob

The issue marked as closed by this has not been reproducible, so this fix was done based only on reading the issue description and code inspection.

It may be that the problem is caused by something else, but even if this PR turns out not to solve the problem it introduces very little complexity, and should be completely safe, and with some likelyhood will solve or at least improve the issue

If the problem persists this change will log some info about the error that occurred but will proceed without saving the cache

Related Issue(s)

Fixes #9146

@vercel
Copy link

vercel bot commented Nov 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Nov 15, 2022 at 7:18PM (UTC)

When writing nxdeps.json prevent parallel processes from seing half-written files
and prevent half written files to be left in case of process crash tob

The issue marked as closed by this has not been reproducible, so
this fix was done based only on reading the issue description and
code inspection.

It may be that the problem is caused by something else, but even
if this PR turns out not to solve the problem it introduces very
little complexity, and should be completely safe, and with some
likelyhood will solve or at least improve the issue

If the problem persists this change will log some info about
the error that occurred but will proceed without saving the cache

ISSUES CLOSED: nrwl#9146
@FrozenPandaz FrozenPandaz force-pushed the atomic-write-project-graph-cache branch from ef8432c to 6837280 Compare November 15, 2022 19:13
Copy link
Collaborator

@FrozenPandaz FrozenPandaz left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Rebased it and rerunning the tests to see if they pass.

@lukeramsden
Copy link

May also fix #12389?

@FrozenPandaz FrozenPandaz merged commit 7467e71 into nrwl:master Nov 17, 2022
@FrozenPandaz
Copy link
Collaborator

May also fix #12389?

Yes, that should also be fixed. 🤞

@jonhamm jonhamm deleted the atomic-write-project-graph-cache branch March 7, 2023 08:50
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error reading nxdeps.json
3 participants