-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make compilecache atomic #30174
Make compilecache atomic #30174
Conversation
Previously, the cache path is directly passed to the --output-ji option of the subprocess for generating compile cache. However, when several processes are compiling the same package, one process may modify the file while another process is calculating the checksum, yielding a broken cache. This patch let each process create a cache in a private temporary path and then atomically rename it to the final cache path.
Can I suggest adding an environment variable or command line option to specify the parent directory for |
On second thought, if all processes are going to be doing filesystem operations, then there should be a separate path for the cache files (both temporary and final). |
@JaredCrean2 FYI, you can use environment variable https://docs.julialang.org/en/v1/stdlib/Pkg/#Glossary-1
The purpose of this PR is to make cache file creation atomic. Using different filesystem seems to defeat the purpose. |
(I was meant to write |
The problem is The problem with this PR is that there will (temporarily) be |
How about creating a symlink But I agree having some way to configure the path |
I created a new issue. Symlinking seems like a reasonable workaround (although an FAQ entry to warn people that the default configuration can be problematic is some cases might be warranted). |
The problem with symlinking is that Windows users get left out in the cold (AFAIU, symlinks can't be established from user-mode programs in Windows). |
There's already code to handle this in dump.c. We should probably move that logic here. |
@jpsamaroo Symlink is only relevant for HPC environment. Not sure Windows is used there. Besides, there are other workarounds. I mentioned them in the FAQ. @vtjnash Or remove the temporary file creation code from dump.c? Either way, I think this issue should be fixed by 1.1 as it's very hard to use Julia in HPC environment without atomic precompilation. |
cache files. It may become a major issue in slow and/or small distributed | ||
file systems. There are a few possible workarounds: | ||
|
||
1. Use `julia` with `--compilecache=no` flag to turn off precompilation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option has been renamed: https://github.com/JuliaLang/julia/pull/23616/files
compilecache -> compiled-modules
Co-Authored-By: Charles Kawczynski <charliekawczynski@gmail.com>
Yeah, sorry, that is what I meant. |
I hate to ping, but are there any updates on merging this? |
It appears that someone needs to pick this up and finish and/or re-write it. |
We would love to have this fixed for the VS Code Julia extension as well. We are getting a fair number of crash reports where users start two instances of VS Code that both trigger precompile of the core LanguageServer.jl packages, and then things crash. |
You can work around this particular problem by
|
I've realized that the real problem here is that the workers have different settings than the master (I'm working from Juno). So When I use Julia from the command line the problem goes away -- apparently the master and the workers settings are in sync. |
This can be closed now I believe. |
Previously, the cache path is directly passed to the --output-ji option of the subprocess for generating compile cache. However, when several processes are compiling the same package, one process may modify the file while another process is calculating the checksum, yielding a broken cache. This patch let each process create a cache in a private temporary path and then atomically rename it to the final cache path.
Before this PR, I can consistently invoke
Warning: The call to compilecache failed to create a usable precompiled cache file for Example
with:With this PR it does not show any warnings (so far).
ref: https://discourse.julialang.org/t/precompilation-error-using-hpc/17094