opam icon indicating copy to clipboard operation
opam copied to clipboard

Race condition when downloading the same archive twice at the same time

Open kit-ty-kate opened this issue 1 year ago • 1 comments

On rare occasions, the cache will be written in at the same time and the following error appears:

#=== ERROR while fetching sources for utop.2.12.0 =============================#
OpamSolution.Fetch_fail("/usr/bin/opam: \"symlink\" failed on /home/opam/.opam/download-cache/sha256/ad/ad19c859a783bec573cd91e810c54d0e6b70f339d0a4fed55ec672ae408aa1ea: File exists")

Steps to reproduce:

  • Clear the cache
  • Create two switches
  • Exec opam install --switch <switch-1> <pkg> & ; opam install --switch <switch-2> <pkg> & ; wait
  • Reapeat until one breaks

Version: dbe3066b720e57d8e288e73294999c0b594b2ab0

kit-ty-kate avatar Nov 23 '23 17:11 kit-ty-kate

from dev meeting: we need to handle the exception. If file exists, checks that it is the good one.

rjbou avatar Nov 27 '23 17:11 rjbou