Skip to content

Commit 488dda8

Browse files
committed
CA-226280: Fix the cancel_fn call on failed check_cancelling.
If `check_cancelling` fails then `cancel_fn` called with `with_cancel` is removed from Task cancel list and `cancel_fn` is never getting executed. Signed-off-by: Sharad Yadav <[email protected]>
1 parent e69ba42 commit 488dda8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ocaml/xapi/task_server.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ module Task = functor (Interface : INTERFACE) -> struct
225225
Mutex.execute t.tm (fun () -> t.cancel <- cancel_fn :: t.cancel);
226226
Stdext.Pervasiveext.finally
227227
(fun () ->
228-
check_cancelling t;
228+
(try
229+
check_cancelling t
230+
with e ->
231+
cancel_fn ();
232+
raise e);
229233
f ()
230234
)
231235
(fun () -> Mutex.execute t.tm (fun () -> t.cancel <- List.tl t.cancel))

0 commit comments

Comments
 (0)