Here and in other finalization functions in this file, it is unsafe to use enter/leave_blocking_section in C finalizers, as per the documentation (this can cause the GC to run). If it worked until now somehow, this will definitely blow up in OCaml 5 which has even tighter constraints.
A possible workaround is to register finalization functions with Gc.finalize instead of the caml_alloc_final/the finalizer field of caml_alloc_custom. In this case one can call a C function that can use enter/leave_blocking_section.
https://github.com/ygrek/ocaml-mysql/blob/ac1fddf6cfcd9f80c55c11ab8856f9a4810ba5da/mysql_stubs.c#L175-L177
Here and in other finalization functions in this file, it is unsafe to use enter/leave_blocking_section in C finalizers, as per the documentation (this can cause the GC to run). If it worked until now somehow, this will definitely blow up in OCaml 5 which has even tighter constraints.
A possible workaround is to register finalization functions with
Gc.finalize
instead of the caml_alloc_final/the finalizer field of caml_alloc_custom. In this case one can call a C function that can use enter/leave_blocking_section.