Open talex5 opened 1 year ago
I also noticed that Printexc.record_backtrace true doesn't seem to apply to new domains (but OCAMLRUNPARAM=b does). Is this intentional?
Thanks for the report! I created a separate issue to track this: #12363.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
I can still reproduce the behaviour signaled in this issue.
Propagating the backtrace from the spawnee to the spawner makes sense; there is a small performance cost, but it is fine if we think of domain creation/joins are rare events. I would implement this by tweaking the Domain.Raw.state
type, changing Finished of ('a, exn) result
into Finished of ('a, exn * Printexc.raw_backtrace option)
. This value is built from the C side in runtime/domain.c, so changing this (and reraising appropriately on Domain.join
) needs a bit of C-level manipulation of OCaml values, that is never pleasant. (See also the conversation in https://github.com/ocaml/ocaml/pull/12409#discussion_r1271486676 )
The above code prints:
It would be good to include the backtrace from the new domain. Eio has code to do this (https://github.com/ocaml-multicore/eio/pull/571), but @avsm suggested reporting it here too, at least as a documentation issue.
I also noticed that
Printexc.record_backtrace true
doesn't seem to apply to new domains (butOCAMLRUNPARAM=b
does). Is this intentional?Also, ocaml, ocamlc, and ocamlopt all give quite different backtraces, which seems surprising: