Closed
Description
The following program triggers a segfault on my machine.
dune:
(executable
(name task_issue_crash)
(modules task_issue_crash)
(libraries domainslib))
task_issue_crash.ml:
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
;;
begin
let pool1 = Task.setup_pool ~num_additional_domains:2 () in
let pool2 = Task.setup_pool ~num_additional_domains:1 () in
let pool1_prom0 = Task.async pool1 work in
let pool2_prom0 = Task.async pool2 work in
let pool2_prom1 = Task.async pool2 work in
Task.run pool1 (fun () -> List.iter (fun p -> Task.await pool1 p) [pool1_prom0]);
Task.run pool2 (fun () -> List.iter (fun p -> Task.await pool2 p) [pool2_prom0; pool2_prom1]);
Task.teardown_pool pool1;
Task.teardown_pool pool2;
end
$ dune exec ./task_issue_crash.exe
Segmentation fault (core dumped)
I think that the Task.run
usage abides by the specification:
This function should be used at the top level to enclose the calls to other
functions that may await on promises. This includes {!await},
{!parallel_for} and its variants. Otherwise, those functions will raise
[Unhandled] exception. *)
I get a segfault running it on both
- 4.12+domains (installed through opam IIRC) and
- 4.14.0+domains+dev0 git hash '318b23950' installed manually from the latest git version yesterday (Thu, Dec.9)
and with the latest domainslib installed through opam with opam source domainslib --dev --pin
.
This is on an old Intel dual-core x86_64 Thinkpad (w/4 CPU threads) running Linux 5.4.0-91-generic.
Metadata
Metadata
Assignees
Labels
No labels