Skip to content

Conversation

@dijkstracula
Copy link

@dijkstracula dijkstracula commented Nov 20, 2025

This patch ports https://github.com/ocaml/ocaml/pull/14363/files , which is #2 but implemented properly, into our fork. (Since we don't run the test suite I elided those files.)

Test plan: This patch was written by OCaml devs so testing here is just meant to ensure I applied the relevant parts of the patch correctly. There were no issues backporting it from the 5.5 trunk so I was not expecting any strange results, however: confirmed before/after behaviour on a trivial program that raises inside a child:

let _ =
  let f () = failwith "in the child domain" in
  match Domain.(spawn f |> join) with
  | v -> ()
  | exception e ->
      let bt = Printexc.get_raw_backtrace () in
      Printexc.raise_with_backtrace e bt
$ # BEFORE: backtrace terminates at the domain join point
$ rm a.out; ocamlopt test.ml && OCAMLRUNPARAM='b=1' ./a.out
Fatal error: exception Failure("in the child domain")
Raised at Stdlib__Domain.join in file "domain.ml", line 299, characters 16-24
Called from Test in file "test.ml", line 3, characters 16-31

$ #AFTER: we observe the full backtrace cross-domain
$ opam pin add ocaml-variants.5.3.0+options "git+file:///Users/ntaylor/code/ocaml#nathan/domain_join_preserves_backtrace_upstream" --update-invariant -y
$  rm a.out; ocamlopt test.ml && OCAMLRUNPARAM='b=1' ./a.out
Fatal error: exception Failure("in the child domain")
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Stdlib__Domain.spawn.body in file "domain.ml", line 266, characters 16-20
Re-raised at Stdlib__Domain.spawn.body in file "domain.ml", line 282, characters 8-17
Re-raised at Stdlib__Domain.join in file "domain.ml", line 299, characters 22-57
Called from Test in file "test.ml", line 3, characters 16-31

Copy link

@yosefAlsuhaibani yosefAlsuhaibani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care that the msvc build is failing?

@dijkstracula
Copy link
Author

The build itself succeeds but for some reason the Windows CI job is not configured correctly so it bombs out when it tries to run unit tests :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants