mirage / irmin

Irmin is a distributed database that follows the same design principles as Git
https://irmin.org
ISC License
1.85k stars 157 forks source link

irmin-client test failure #2348

Closed hannesm closed 1 month ago

hannesm commented 1 month ago

Dear everybody,

as observed while releasing dns (https://github.com/ocaml/opam-repository/pull/26773), there's a test failure with irmin-client:

#=== ERROR while compiling irmin-client.3.9.0 =================================#
# context              2.4.0~alpha1~dev | linux/x86_64 | ocaml-base-compiler.4.14.2 | file:///home/opam/opam-repository
# path                 ~/.opam/4.14/.opam-switch/build/irmin-client.3.9.0
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune runtest -p irmin-client
# exit-code            1
# env-file             ~/.opam/log/irmin-client-7-be04b3.env
# output-file          ~/.opam/log/irmin-client-7-be04b3.out
### output ###
# File "test/irmin-client/dune", line 2, characters 7-11:
# 2 |  (name test)
#            ^^^^
# (cd _build/default/test/irmin-client && ./test.exe)
# Fatal error: exception The default generator is not yet initialized. 
# To initialize the RNG with a default generator, and set up entropy collection and periodic reseeding as a background task, do the following:
#   If you are using MirageOS, use the random device in config.ml: `let main = Mirage.main "Unikernel.Main" (random @-> job)`, and `let () = register "my_unikernel" [main $ default_random]`. 
#   If you are using Lwt, execute `Mirage_crypto_rng_lwt.initialize (module Mirage_crypto_rng.Fortuna)` at startup. 
#   If you are using Async, execute `Mirage_crypto_rng_async.initialize (module Mirage_crypto_rng.Fortuna)` at startup. 
#   If you are using Eio, execute in one of the fibers `Mirage_crypto_rng_eio.run (module Fortuna) env` (`env` from `Eio_main.run`).
#    
#   Otherwise, there is no periodic reseeding. For an initial seed from getrandom(), execute `Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)`. You can use `Mirage_crypto_rng.accumulate` and `Mirage_crypto_rng.reseed` to reseed the RNG manually.

Since that test is marked with "enabled_if (<> %{system} "freebsd")", I guess it is not my adventure to figure out what is going wrong here.

I notice that in test/irmin-client/util.ml you have let () = Mirage_crypto_rng_lwt.initialize (module Mirage_crypto_rng.Fortuna) -- but it looks like it is run too late. Maybe execute it earlier? Maybe do a dune runtest with OCAMLRUNPARAM=b to get a backtrace?

Thanks a lot. Also, any hints what to do in opam-repository with irmin-client 3.9.0 would be appreciated: adjust some bounds (but which?), disable tests, leave it as is?

clecat commented 1 month ago

Hello @hannesm, My apologies for the inconveniences. We had this issue recently on our CI, it was however fixed by this PR, which added the initialization inside the test/irmin-client/util.ml file. However it has yet to be part of a release.

In the meantime, to answer your question, irmin-client.3.9.0 should have an upper bound on the mirage-crypto library set to be <=0.11.3. Local testing showed that it should work properly.

I hope this helps, Gwen

hannesm commented 1 month ago

Thanks Gwen for your prompt reply. I didn't research when that initialize was added, good to know that you already fixwd in on the main branch! :)