multicoretests
multicoretests copied to clipboard
The GC stress test can trigger a fatal error in `malloc`
Spotted on OCaml 5.2.1 on 32 bit, a run of the Gc stress test triggered a fatal error in malloc:
Page size: 4096
random seed: 367524569
generated error fail pass / total time test name
[ ] 0 0 0 0 / 1000 0.0s STM Gc stress test parallel
malloc(): invalid size (unsorted)
File "src/gc/dune", line 46, characters 7-27:
46 | (name stm_tests_par_stress)
^^^^^^^^^^^^^^^^^^^^
(cd _build/default/src/gc && ./stm_tests_par_stress.exe --verbose)
Command got signal ABRT.
[ ] 0 0 0 0 / 1000 0.0s STM Gc stress test parallel (generating)
Oh? 😮 I initially thought that this was a case of https://github.com/ocaml/ocaml/issues/13512 but after checking, the fix PR for that https://github.com/ocaml/ocaml/pull/13553 has been included in both 5.3 and the 5.2.1 patch release... 🤔
I was able to reproduce this consistently with the reported seed in a docker container running ocaml 5.2.1:
$ docker run -it --platform linux/i386 ocaml/opam:debian-12-ocaml-5.2
$ sudo cp -p /usr/bin/opam-2.3 /usr/bin/opam
$ opam update
$ opam install qcheck-core
$ git clone https://github.com/ocaml-multicore/multicoretests.git
$ cd multicoretests/
$ dune build src/gc/
$ dune exec src/gc/stm_tests_par_stress.exe -- -v -s 367524569
Page size: 4096
random seed: 367524569
generated error fail pass / total time test name
[ ] 512 0 0 512 / 1000 41.1s STM Gc stress test parallelmalloc(): invalid size (unsorted)
Aborted (core dumped)
However, I haven't been able to trigger the crash on ocaml 5.3.0 - with the above seed or with any other seed... 🤔