-
Notifications
You must be signed in to change notification settings - Fork 416
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
Parallel build with dune is not reproducible #9152
Comments
See also coq/coq#17207 , and the discussion about |
Most likely is that If that's the case, |
Evidence needed. We've worked pretty hard to make builds reproducible. Is there any way to understand what's going on here, besides us replacing Dune with a shell script? |
More discussion about Coq problems in coq/coq#11229 |
Dune does little special here; will just call We have similar problems in Coq, and they were due to So this is where I would look next.
For your simple project you can indeed just take Dune often find these kind of problems more often than make, as it does setup |
From a distance, the Coq problems seem to come from its hash-consing mechanism. The OCaml compilers don't do any hash consing. It is true that they use marshaling, and that marshaling is sensitive to sharing, but it looks like our sharing is reproducible, as we haven't got any report of non-reproducibility recently, except for this specific library. The library in question is trivial but uses a somewhat unusual (to me at least) Dune file, with the |
One problem in Coq was due to hash-consing, but we still have the bug and we couldn't trace it back to hashconsing, trying with
That's not a problem as far as I can see, (flags :standard \ -O2) for example. |
IMHO the best next step is to get the two |
I extracted the two --- dune.logs/log.1 2039-12-15 17:21:00.276666666 +0100
+++ dune.logs/log.2 2023-11-13 04:04:12.463333332 +0100
@@ -2,8 +2,8 @@
# OCAMLPARAM: unset
# Shared cache: disabled
# Workspace root: /home/abuild/rpmbuild/BUILD/ocaml-camlp-streams-5.0.1
-# Auto-detected concurrency: 1
-$ /usr/bin/ocamlc.opt -config > /tmp/dune_f31f1b_output
+# Auto-detected concurrency: 4
+$ /usr/bin/ocamlc.opt -config > /tmp/dune_d2fa9c_output
# Dune context:
# { name = "default"
# ; kind = "default"
@@ -126,15 +126,15 @@
$ /usr/bin/ocaml -I +compiler-libs /home/abuild/rpmbuild/BUILD/ocaml-camlp-streams-5.0.1/_build/.dune/default/dune.ml
$ (cd _build/default && /usr/bin/ocamlc.opt -w -40 -w -3 -g -bin-annot -I test/.stream_stdlib.objs/byte -no-alias-deps -o test/.stream_stdlib.objs/byte/stream_stdlib.cmo -c -impl test/stream_stdlib.ml)
$ (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I test/.stream_camlp_streams.objs/byte -I .camlp_streams.objs/byte -no-alias-deps -o test/.stream_camlp_streams.objs/byte/stream_camlp_streams.cmo -c -impl test/stream_camlp_streams.ml)
-$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3 -g -I test/.stream_stdlib.objs/byte -I test/.stream_stdlib.objs/native -intf-suffix .ml -no-alias-deps -o test/.stream_stdlib.objs/native/stream_stdlib.cmx -c -impl test/stream_stdlib.ml)
$ (cd _build/default && /usr/bin/ocamlc.opt -w -40 -w -3 -g -bin-annot -I test/.linking.eobjs/byte -I .camlp_streams.objs/byte -I test/.stream_stdlib.objs/byte -no-alias-deps -o test/.linking.eobjs/byte/dune__exe__Linking.cmo -c -impl test/linking.ml)
-$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -I test/.stream_camlp_streams.objs/byte -I test/.stream_camlp_streams.objs/native -I .camlp_streams.objs/byte -I .camlp_streams.objs/native -intf-suffix .ml -no-alias-deps -o test/.stream_camlp_streams.objs/native/stream_camlp_streams.cmx -c -impl test/stream_camlp_streams.ml)
+$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3 -g -I test/.stream_stdlib.objs/byte -I test/.stream_stdlib.objs/native -intf-suffix .ml -no-alias-deps -o test/.stream_stdlib.objs/native/stream_stdlib.cmx -c -impl test/stream_stdlib.ml)
$ (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I test/.equality.eobjs/byte -I .camlp_streams.objs/byte -I test/.stream_camlp_streams.objs/byte -I test/.stream_stdlib.objs/byte -no-alias-deps -o test/.equality.eobjs/byte/dune__exe__Equality.cmo -c -impl test/equality.ml)
+$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -I test/.stream_camlp_streams.objs/byte -I test/.stream_camlp_streams.objs/native -I .camlp_streams.objs/byte -I .camlp_streams.objs/native -intf-suffix .ml -no-alias-deps -o test/.stream_camlp_streams.objs/native/stream_camlp_streams.cmx -c -impl test/stream_camlp_streams.ml)
$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3 -g -a -o test/stream_stdlib.cmxa test/.stream_stdlib.objs/native/stream_stdlib.cmx)
$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3 -g -I test/.linking.eobjs/byte -I test/.linking.eobjs/native -I .camlp_streams.objs/byte -I .camlp_streams.objs/native -I test/.stream_stdlib.objs/byte -I test/.stream_stdlib.objs/native -intf-suffix .ml -no-alias-deps -o test/.linking.eobjs/native/dune__exe__Linking.cmx -c -impl test/linking.ml)
$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -a -o test/stream_camlp_streams.cmxa test/.stream_camlp_streams.objs/native/stream_camlp_streams.cmx)
$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -I test/.equality.eobjs/byte -I test/.equality.eobjs/native -I .camlp_streams.objs/byte -I .camlp_streams.objs/native -I test/.stream_camlp_streams.objs/byte -I test/.stream_camlp_streams.objs/native -I test/.stream_stdlib.objs/byte -I test/.stream_stdlib.objs/native -intf-suffix .ml -no-alias-deps -o test/.equality.eobjs/native/dune__exe__Equality.cmx -c -impl test/equality.ml)
$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -w -3 -g -o test/linking.exe camlp_streams.cmxa test/stream_stdlib.cmxa test/.linking.eobjs/native/dune__exe__Linking.cmx)
-$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -o test/equality.exe test/stream_stdlib.cmxa camlp_streams.cmxa test/stream_camlp_streams.cmxa test/.equality.eobjs/native/dune__exe__Equality.cmx)
$ (cd _build/default/test && ./linking.exe) > _build/default/test/issue4.output
+$ (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -o test/equality.exe test/stream_stdlib.cmxa camlp_streams.cmxa test/stream_camlp_streams.cmxa test/.equality.eobjs/native/dune__exe__Equality.cmx)
$ (cd _build/default/test && ./equality.exe) > _build/default/test/equality.output Which of these produce |
I don't think any of the lines that are shown in your diff are actually related to |
Indeed the full logs are needed to be able to reverse engineer the computation graph and see what was around the emission of |
following field of the cmt differ:
|
@hhugo would it be possible to obtain the diff? |
You're right, I was confused, sorry about that. I had the impression that the build differs whether OCaml is < 4.14, = 4.14, or >= 5.0, and wanted to understand this better, but it's probably a dead end.
OK, so it's really two different data structures that are being marshaled, not just two equal structures that share differently. One possibility is that stream.cmti is generated twice by two independent commands (e.g. an ocamlc invocation and an ocamlopt invocation), and for some reason the two files differ, and one or the other wins the race. This should show up in the build logs, though. |
Indeed, the build differs. For 4.14 (the version used in ocaml/camlp-streams#9), the source file For >= 5.0 the actual sources in the project repository are used instead of the Incidentally, I was able to reproduce the issue with Make, see details at ocaml/camlp-streams#9 (comment) |
It looks like Dune is innocent this time :-) Let me close this report while we look at @nojb's make-based repro. |
Initial_env has an additional "Persistent" constructor on top of the summary in one of the file. |
See report at ocaml/camlp-streams#9 .
Help with understanding the issue would be appreciated. This is a trivial project with 2 OCaml source files, so it's hard to see what could be wrong in the Dune files. Thanks!
The text was updated successfully, but these errors were encountered: