Open Lupus opened 1 year ago
Interesting, there is certainly a lot that can go wrong with the combination of async, panics and OCaml exceptions!
I don't know anything about how tokio manages panics and am not even sure where to start looking into this issue. Does disabling the ocaml-rs panic hook get you a more helpful backtrace?
I'll try to come up with some repro later, chasing some other segfault at the moment 😵
I'm spawning some tokio task from my
#[ocaml::func]
Rust function, that is called from OCaml. The task itself does not call any OCaml code inside, but when a panic happens inside that task, I see surprising errors in valgrind before the whole thing segfaults:Tokio runtime worker thread trying to call
caml_fatal_uncaught_exception
, what could possibly go wrong 😂I'm not yet sure on why this is happening, I see that ocaml-rs is setting up that panic hook in initial setup [1], probably rust takes the hook from the thread, that created tokio task?
[1] https://github.com/zshipko/ocaml-rs/blob/master/src/macros.rs#L62