open Domainslib
(* a simple work item, from ocaml/testsuite/tests/misc/takc.ml *)
let rec tak x y z =
if x > y then tak (tak (x-1) y z) (tak (y-1) z x) (tak (z-1) x y)
else z
let work () =
for _ = 1 to 200 do
assert (7 = tak 18 12 6);
done
;;
for i=0 to 10 do
let () = Printf.printf "%i %!" i in
let pool = Task.setup_pool ~num_additional_domains:2 () in
let p0 = Task.async pool work in
let p1 = Task.async pool (fun () -> work (); Task.await pool p0) in
let p2 = Task.async pool (fun () -> work (); Task.await pool p1) in
let p3 = Task.async pool (fun () -> work (); Task.await pool p0) in
let () = List.iter (fun p -> Task.await pool p) [p0;p1;p2;p3] in
let () = Task.teardown_pool pool in ()
done
When I run it, the first 1-5 iterations go well (numbers are printed) until some iteration where 2-CPUs out of 4 on my laptop take turns to spike to 100% - without the program going further. The CPU activity indicates that the underlying tasks are trying (but failing) to make progress (a livelock?). I still haven't experienced the program completing all 10 outer iterations.
I observe this on both
4.12+domains (installed thought opam IIRC) and
4.14.0+domains+dev0 git hash '318b23950' installed manually from the latest git version yesterday (Thu, Dec.9)
and with domainslib 0.3.2 installed through opam.
This is on an old Intel dual-core x86_64 Thinkpad (w/4 CPU threads) running Linux 5.4.0-91-generic.
I'm experiencing issues where simple Task.async/await usage in some runs cause non-termination.
dune
:task_issue_414.ml
:When I run it, the first 1-5 iterations go well (numbers are printed) until some iteration where 2-CPUs out of 4 on my laptop take turns to spike to 100% - without the program going further. The CPU activity indicates that the underlying tasks are trying (but failing) to make progress (a livelock?). I still haven't experienced the program completing all 10 outer iterations.
I observe this on both
and with domainslib 0.3.2 installed through opam.
This is on an old Intel dual-core x86_64 Thinkpad (w/4 CPU threads) running Linux 5.4.0-91-generic.