Skip to content

Make write_env_usage atomic #2661

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

Merged

Conversation

IanButterworth
Copy link
Member

Fixes #2633

As per @StefanKarpinski's suggestion in #2633 (comment)

@StefanKarpinski
Copy link
Member

How about also filtering it down either when we load it or when we write it back to only keep the most recent usage of each manifest path? Otherwise I think that as this file gets large this will start to be problematically slow. If you're just appending (which isn't atomic, as we've learned), then it makes sense to keep all the old entries, but since we're not doing that any more, let's clean up as we go.

@IanButterworth IanButterworth force-pushed the ib/atomic_usage_file_write branch from abe8c0f to ca5e6b8 Compare July 13, 2021 04:06
@IanButterworth
Copy link
Member Author

IanButterworth commented Jul 13, 2021

I think that's implemented now. It tidied up my usage file nicely, and sorted it.

Btw, I have a feeling the code could be reduced a bit

@IanButterworth IanButterworth force-pushed the ib/atomic_usage_file_write branch from ca5e6b8 to 4246e3d Compare July 13, 2021 04:10
@IanButterworth IanButterworth merged commit 5bbfef6 into JuliaLang:master Jul 15, 2021
@IanButterworth IanButterworth deleted the ib/atomic_usage_file_write branch July 15, 2021 16:05
@StefanKarpinski
Copy link
Member

Just want to add that this is really nicely done and should make Pkg much more useable on shared file systems.

KristofferC pushed a commit that referenced this pull request Aug 31, 2021
Fixes #2633

(cherry picked from commit 5bbfef6)
KristofferC pushed a commit that referenced this pull request Aug 31, 2021
Fixes #2633

(cherry picked from commit 5bbfef6)
KristofferC pushed a commit that referenced this pull request Sep 6, 2021
Fixes #2633

(cherry picked from commit 5bbfef6)
KristofferC pushed a commit that referenced this pull request Sep 6, 2021
Fixes #2633

(cherry picked from commit 5bbfef6)
KristofferC added a commit that referenced this pull request Sep 16, 2021
KristofferC added a commit that referenced this pull request Sep 16, 2021
KristofferC added a commit that referenced this pull request Sep 16, 2021
KristofferC added a commit that referenced this pull request Sep 16, 2021
release-1.7 Revert "Make `write_env_usage` atomic (#2661)"
@IanButterworth
Copy link
Member Author

welp

@StefanKarpinski
Copy link
Member

I'm pretty sure that all that was required to fix this was adding force=true on this line:

https://github.com/JuliaLang/julia/blob/c5f348726cebbe55e169d4d62225c2b1e587f497/base/file.jl#L328

@IanButterworth
Copy link
Member Author

That'd be nice and simple!

Before that I'll try to add a multi-process test to Pkg master that reproduces the problem

@KristofferC
Copy link
Member

I'm pretty sure that all that was required to fix this was adding force=true on this line:

Nah. See JuliaLang/julia#42253 (comment).

KristofferC added a commit that referenced this pull request Dec 11, 2021
KristofferC added a commit that referenced this pull request Dec 12, 2021
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.

Race condition in writing manifest_usage.toml?
3 participants