Organisationsedwintorokangstrom63836d

Remove Lazy from native and bytecode modes: not thread safe Angstrom (and as a consequence Uri.of_string) is not thread-safe. On OCaml 4 this actually leads to a SIGSEGV sometimes, on OCaml 5 it raises `CamlinternalLazy.Undefined`. This could be fixed by adding a `Lazy.force p |> ignore` so that the Lazy value is never observable from a concurrent/parallel context, but I prefer to remove Lazy completely, at least until the reason for the OCaml 4 segfault is understood. Using a ref here is safe, because the ref is only changed once before 'fix_direct' returns. And it still preserves the optimization that Lazy did: the fixpoint is only computed once. While the fixpoint is being calculated the ref is set to a closure that raises an exception. This is compatible with the previous behaviour, where `f` calling its argument in a non-delayed way would've raised `CamlinternalLazy.Undefined`. When used correctly the changing `ref` is not observable from concurrent/parallel context, and even if it would be it wouldn't lead to the program crashing. This avoids the crash noticed in https://github.com/mirage/ocaml-uri/issues/178 Use @gasche's suggestion to avoid an option by storing a function that would raise initially Signed-off-by: Edwin Török <edwin.torok@cloud.com>

Jun 27 12:25 +00:00
21h56m
*Variants labelled (experimental) are still undergoing testing; if they have failed it may be a bug in OCaml-CI.