Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Original bug ID: 6919
We are experiencing strange crashes in Gc after switching from 4.02.1 to 4.02.2 but I don't have a small repro case for now (and as such cannot exclude misbehaving C bindings etc but the code is stable with 4.02.1), maybe you have a quick idea based on symptoms.
AFAIU it changes behaviour in the way that final_table offsets are now not updated after every minor collection, I do not know whether
Here are the details of my issue if of any use :
It crashes when calling functions from final_table, in my case it is a Gc alarm registered by ocamlnet, but that alarm
At the start of program final_table looks alright with one entry like this :
(gdb) ml_dump/r final_table 4
but at crash time it is obviously wrong :
(gdb) ml_dump final_table 4
instead of "Private_Dirty" string it can be any ocaml value.
Stack trace looks like this :
When run with debug runtime it fails on assert on line 163 in byterun/finalize.c
void caml_final_do_strong_roots (scanning_action f)
Assert (old == young);
I would be very much grateful for any pointers how to debug this or provide more info..
Steps to reproduce
None for now, but I can reproduce it locally in less than 5 minutes.
Comment author: @ygrek
This patch seems to fix it for me
diff --git a/byterun/minor_gc.c b/byterun/minor_gc.c
Comment author: @edwintorok
FWIW I just ran into this (with various symptoms: application crashing in pthread_cancel unwinder on exit, segfault after fork when Lwt is built with libev but not when built without, or segfault after fork when using OpenSSL from Lwt even without libev): ocsigen/lwt#168
I've created the testcase below before finding this bug (indeed from OCamlnet's Netsys_pollset_win32.ml), and I confirm that the patch fixes both the testcase and the segfaults in my application:
let x = ref false
(* ocamlc x.ml -runtime-variant d -o x && ./x