lwt 2.1.1 ========== Code: open Lwt let cococo = ref 0 let connections = Lwt_pool.create 1 (fun () -> let () = (incr cococo) in return (string_of_int !cococo)) let test x dbh = catch (fun _ -> Lwt_io.printl ("Start " ^ x ^ dbh) >> Lwt_unix.sleep 1.0 >> Lwt_io.printl ( "[" ^ x ^ "] A " ^ dbh) >> Lwt_unix.sleep 1.0 >> Lwt_io.printl ( "[" ^ x^ "] B " ^ dbh) >> Lwt_unix.sleep 1.0 >> Lwt_io.printl ( "[" ^ x^ "] C " ^ dbh ); ) (fun e -> Lwt_io.printl ( "[" ^ x ^ "] Cancelled " ^ dbh ^ " " ^ Printexc.to_string e) >> Lwt.fail e) let ct n = Lwt_pool.use connections (test n) let t = Lwt.join [ct "t1"; ct "t2" ; ct "t3"; ct "t4"; ct "t5" ] in Lwt_main.run t ============ Compilation command: ocamlfind ocamlc -o test -syntax camlp4o -package lwt,lwt.unix,lwt.syntax -linkpkg test.ml ====================== Output: Start t51 [t5] A 1 [t5] B 1 [t5] C 1 Start t41 [t4] Cancelled 1 Lwt.Canceled Start t31 [t3] Cancelled 1 Lwt.Canceled Start t21 [t2] Cancelled 1 Lwt.Canceled Start t11 [t1] Cancelled 1 Lwt.Canceled Fatal error: exception Lwt.Canceled ======================== What's wrong in code? Why it raise Canceled exception?