-
-
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
Race condition when updating cache #14118
Comments
I was expecting this one to strike - but not so soon! |
Essentially a duplicate of #13684. Force a precompile manually if you want to use a package in parallel. We already are creating Also ref #12723 which doesn't have any great way of knowing whether other instances of Julia happen to be in the process of creating the same file. |
Can we use discretionary file locking? |
#13684 is different -- that is about machine-specific caches, whereas this issue here is about an access conflict. I'm not sure what #12699 addresses. The issue here is caused by files not being generated atomically; maybe the solution to #12699 decayed over time? At the moment, this happens sequentially:
The error occurs if the first two actions overlap, since the file can't be deleted twice. The other race -- two processes writing to the same file -- could lead to silent corruption. I'm working on a solution in #14143. |
closed by #14145 |
I am running Julia in parallel, i.e. I am starting several Julia interpreters simultaneously. Usually this works fine. When a package is outdated, both will recompile it.
However, I just encountered this error. It went away when I tried again, so I assume it is a race condition.
This is with the release branch of Julia 0.4.
The standard way to handle this in Unix is to write to a temporary file (
$output.tmp
), and then use an atomic rename to update the cache (mv("$output.tmp", output)
). Removing the file beforehand is not necessary, and can't be done safely unless one locks the directory.The text was updated successfully, but these errors were encountered: