The plan is to replace the libuv backend (Replace libuv · Issue #434 · ocaml-multicore/eio · GitHub). We should be able to run the event loop in OCaml, which will avoid this problem.
Would you be keen to share the code of your workaround for installing effect handlers so they catch effects performed inside Lwt promises? I’ve hit a similar problem and looking for a solution.
Specifically, I’m trying to provide handlers for effects performed inside Dream routes.
The prototype is in this closed Lwt PR. The main idea is to pass the effect handler to the main-loop and then the main-loop installs it when it calls the registered callbacks that correspond to some promises.
It doesn’t work in its current state, but possibly it’s a basis for exploring something that does.
1 Like