Refactor test/dune and add a failing test #2

Merged
reynir merged 12 commits from batch-test into main 2024-10-29 11:21:16 +00:00
Showing only changes of commit 9afb8e29e2 - Show all commits

View file

@ -679,7 +679,11 @@ module Make (Pclock : Mirage_clock.PCLOCK) = struct
| None -> | None ->
(* XXX(dinosaure): serialize [change_and_push]. If we do (* XXX(dinosaure): serialize [change_and_push]. If we do
[Lwt.both (change_and_push ..) (change_and_push ..)], they can not run [Lwt.both (change_and_push ..) (change_and_push ..)], they can not run
concurrently! The second will waiting the first to finish. *) concurrently! The second will waiting the first to finish.
(reynir): Furthermore, we need to create a new task and update
[change_and_push_waiter] before we wait on the existing
[change_and_push_waiter] task without any yield point in between to
ensure serializability. *)
let th, wk = Lwt.wait () in let th, wk = Lwt.wait () in
let th' = t.change_and_push_waiter in let th' = t.change_and_push_waiter in

the reason for this change is: we may have one change_and_push that is active, and when there are then multiple other change_and_push that should be executed, each needs to wait for the next one.

previously, the code had all other change_and_push wait for the same task -- and thus there may have been multiple waiting change_and_push waken up at the same time, leading to races.

the reason for this change is: we may have one change_and_push that is active, and when there are then multiple other change_and_push that should be executed, each needs to wait for the next one. previously, the code had all other change_and_push wait for the same task -- and thus there may have been multiple waiting change_and_push waken up at the same time, leading to races.
t.change_and_push_waiter <- Some th; t.change_and_push_waiter <- Some th;