Dear maintainer,
Thanks for the library.
As I was writing a web server using tiny_httpd, when a lot of image had to be queried in a small amount of time, in some cases the program segfault.
There is the backtrace of the core dump on FreeBSD 15.1 (the segfault also happens on Linux (x64, arm64: ocaml 5.5), FreeBSD (x64: ocaml 5.5), MacOS (arm64: 5.4.1)).
But a part of me thinks that the issue may come from OCaml since with the OCaml 4.14, the issue doesn't seem to occur.
The segmentation fault doesn't seem to appear with the version 5.4.0 of this library.
$ lldb -c shamisen.exe.core ./_build/default/bin/shamisen.exe
(lldb) target create "./_build/default/bin/shamisen.exe" --core "shamisen.exe.core"
Core file '~/Developer/Ocaml/Projects/shamisen/shamisen.exe.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'shamisen.exe', stop reason = signal SIGSEGV
* frame #0: 0x000000082656ed13 libthr.so.3`_pthread_mutex_lock + 35
frame #1: 0x00000008228346a2 libsqlite3.so.0`sqlite3_finalize + 50
frame #2: 0x000000000056fcbc shamisen.exe`stmt_wrap_finalize_gc(v_stmt=<unavailable>) at sqlite3_stubs.c:852:5
frame #3: 0x00000000005a5d19 shamisen.exe`caml_stw_empty_minor_heap_no_major_slice [inlined] custom_finalize_minor(domain=0x00000909e90a9000) at minor_gc.c:809:32
frame #4: 0x00000000005a5c75 shamisen.exe`caml_stw_empty_minor_heap_no_major_slice(domain=0x00000909e90a9000, mark_requested_p=<unavailable>, participating_count=1, participating=0x00000909e90a4000) at minor_gc.c:925:3
frame #5: 0x0000000000587a10 shamisen.exe`caml_try_run_on_all_domains_with_spin_work(sync=1, handler=(shamisen.exe`caml_stw_empty_minor_heap at minor_gc.c:953), data=0x000000083e134dd8, leader_setup=(shamisen.exe`caml_empty_minor_heap_setup at minor_gc.c:873), enter_spin_callback=<unavailable>, enter_spin_data=0x0000000000000000) at domain.c:1932:3
frame #6: 0x00000000005a5e94 shamisen.exe`caml_empty_minor_heaps_once [inlined] caml_try_empty_minor_heap_on_all_domains at minor_gc.c:986:10
frame #7: 0x00000000005a5e60 shamisen.exe`caml_empty_minor_heaps_once at minor_gc.c:1010:5
frame #8: 0x0000000000587e31 shamisen.exe`caml_poll_gc_work at domain.c:2128:5
frame #9: 0x00000000005a602f shamisen.exe`caml_check_urgent_gc(extra_root=9938262957848) at minor_gc.c:1089:5
frame #10: 0x000000000057ceb5 shamisen.exe`caml_alloc_string(len=1048576) at alloc.c:186:14
frame #11: 0x00000000005b53ab shamisen.exe`caml_c_call + 27
frame #12: 0x0000000000532dac shamisen.exe`camlStdlib__Buffer.resize_502 + 156
frame #13: 0x00000000005332d6 shamisen.exe`camlStdlib__Buffer.add_subbytes_701 + 150
frame #14: 0x00000000003b5fde shamisen.exe`camlSkhcUtil__FileSys.read_chan_978 + 126
frame #15: 0x000000000054cc1b shamisen.exe`camlStdlib__Fun.protect_332 + 107
frame #16: 0x00000000003addcd shamisen.exe`camlSkhclibs__Collection.cover_1744 + 141
frame #17: 0x0000000000399b1c shamisen.exe`camlLibshamisen__Server.fun_6841 + 44
frame #18: 0x000000000054cc1b shamisen.exe`camlStdlib__Fun.protect_332 + 107
frame #19: 0x000000000048d285 shamisen.exe`camlTiny_httpd_core__Server.tr_req_1057 + 101
frame #20: 0x000000000048e837 shamisen.exe`camlTiny_httpd_core__Server.fun_3662 + 1367
frame #21: 0x0000000000488174 shamisen.exe`camlTiny_httpd_core__Pool.with_resource_345 + 68
frame #22: 0x0000000000488174 shamisen.exe`camlTiny_httpd_core__Pool.with_resource_345 + 68
frame #23: 0x0000000000488174 shamisen.exe`camlTiny_httpd_core__Pool.with_resource_345 + 68
frame #24: 0x0000000000488174 shamisen.exe`camlTiny_httpd_core__Pool.with_resource_345 + 68
frame #25: 0x000000000046c18f shamisen.exe`camlTiny_httpd_unix.fun_1352 + 63
frame #26: 0x000000000049a024 shamisen.exe`camlThread.fun_789 + 52
frame #27: 0x00000000005b5488 shamisen.exe`caml_start_program + 112
frame #28: 0x000000000058486f shamisen.exe`caml_callback_exn(closure=35056303448, arg=1) at callback.c:0:12
frame #29: 0x00000000005740f7 shamisen.exe`caml_thread_start(v=<unavailable>) at st_stubs.c:722:3
frame #30: 0x000000082656ae41 libthr.so.3`___lldb_unnamed_symbol578 + 337
Thanks for your time.
Dear maintainer,
Thanks for the library.
As I was writing a web server using tiny_httpd, when a lot of image had to be queried in a small amount of time, in some cases the program segfault.
There is the backtrace of the core dump on FreeBSD 15.1 (the segfault also happens on Linux (x64, arm64: ocaml 5.5), FreeBSD (x64: ocaml 5.5), MacOS (arm64: 5.4.1)).
But a part of me thinks that the issue may come from OCaml since with the OCaml 4.14, the issue doesn't seem to occur.The segmentation fault doesn't seem to appear with the version 5.4.0 of this library.
Thanks for your time.