dune icon indicating copy to clipboard operation
dune copied to clipboard

Race condition building project with package management

Open gridbugs opened this issue 1 year ago • 3 comments

Sometimes when building a project with package management I see this error:

    Building ocaml-base-compiler.5.2.0  
    Building ocaml-config.3      
    Building base-unix.base      
    Building ocaml.5.2.0         
    Building seq.base              
    Building ocamlfind.1.9.6+dune  
Error:                             
_build/.sandbox/bed9cbdb5ceececaf0c3aaddc1db1624/_private/default/.dev-tool/odoc/ocamlfind/source/0001-Harden-test-for-OCaml-5.patch:
No such file or directory
-> required by _build/_private/default/.dev-tool/odoc/ocamlfind/target/cookie
-> required by - package topkg
-> required by - package astring
-> required by - package odoc
    Building ocamlbuild.0.15.0+dune

I've seen this on a range of projects, but so far I've only seen it on this specific patch from ocamlfind's package. I don't have a reliable reproduction case yet. It happens very infrequently, and the project always builds as expected when I rerun the command.

gridbugs avatar Sep 11 '24 06:09 gridbugs

This is not linked to race condition. I've tried to print the file path, running dune fmt. I assume you're testing with #10647. It seems the problem is coming from there.

It prints: extra_files: _build/_private/default/.pkg/ocamlfind/source/0001-Harden-test-for-OCaml-5.patch

instead of .dev-tool it is copying inside .pkg.

moyodiallo avatar Sep 11 '24 14:09 moyodiallo

This is not linked to race condition. I've tried to print the file path, running dune fmt. I assume you're testing with #10647. It seems the problem is coming from there.

It prints: extra_files: _build/_private/default/.pkg/ocamlfind/source/0001-Harden-test-for-OCaml-5.patch

instead of .dev-tool it is copying inside .pkg.

My bad, this is not true.

moyodiallo avatar Sep 11 '24 16:09 moyodiallo

I noticed every time you do an initial dune fmt the error appears and after that any time you try to rebuild without cleaning(removing the dev-tool locks), it's works.

I think there's a rule that coming before another one and it's not supposed to do that.

moyodiallo avatar Sep 11 '24 17:09 moyodiallo

I haven't seen this issue in over a year so there's a good chance it's been fixed accidentally. Optimistically closing.

gridbugs avatar Nov 17 '25 09:11 gridbugs