From ac851a6d8123822ac3317627fd633cd4106a71cd Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 1 Apr 2024 15:26:30 -0400 Subject: [PATCH] fix: in `Fut.await`, upon failure, use `resume` otherwise a fairly vicious bug happens: the await-er is resumed on the current runner, not its native one, which can cause deadlocks as it breaks the executors' dependency DAG. When using `resume` there is no bug since `resume` is designed to always schedule on the correct runner. --- src/core/fut.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/fut.ml b/src/core/fut.ml index 91a95a7f..17afb908 100644 --- a/src/core/fut.ml +++ b/src/core/fut.ml @@ -438,7 +438,7 @@ let await (fut : 'a t) : 'a = resume k (Ok ()) | Error (exn, bt) -> (* fail continuation immediately *) - k (Error (exn, bt)))); + resume k (Error (exn, bt)))); }; (* un-suspended: we should have a result! *) get_or_fail_exn fut