From 2014263e36752c4f38a59a1ec89e59235ffa37d2 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Thu, 10 Nov 2022 12:38:45 +0000 Subject: [PATCH] Don't lose backtrace in Switch.run_internal --- lib_eio/core/switch.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_eio/core/switch.ml b/lib_eio/core/switch.ml index c1494ea16..475496ffc 100644 --- a/lib_eio/core/switch.ml +++ b/lib_eio/core/switch.ml @@ -138,10 +138,11 @@ let run_internal t fn = (* Success. *) v | exception ex -> + let bt = Printexc.get_raw_backtrace () in (* Main function failed. Turn the switch off to cancel any running fibers, if it's not off already. *) dec_fibers t; - fail t ex; + fail ~bt t ex; await_idle t; Ctf.note_read t.id; maybe_raise_exs t;