smimram / ocaml-glpk

OCaml bindings for glpk
http://smimram.github.io/ocaml-glpk/
GNU General Public License v2.0
10 stars 2 forks source link

segfault when calling glpk #7

Open c-cube opened 5 years ago

c-cube commented 5 years ago

I will update when I have a proper repro, but for now, here's a partial trace from gdb (with glpk installed from pr #6):

Thread 1 "<process name>" received signal SIGABRT, Aborted.
0x00007ffff78bfd7f in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff78bfd7f in raise () from /usr/lib/libc.so.6
#1  0x00007ffff78aa672 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff7eaa026 in ?? () from /usr/lib/libglpk.so.40
#3  0x00007ffff7f02fcb in ?? () from /usr/lib/libglpk.so.40
#4  0x00007ffff7edc9e8 in ?? () from /usr/lib/libglpk.so.40
#5  0x00007ffff7ed61d0 in ?? () from /usr/lib/libglpk.so.40
#6  0x00007ffff7ed38fe in ?? () from /usr/lib/libglpk.so.40
#7  0x00007ffff7edf67a in ?? () from /usr/lib/libglpk.so.40
#8  0x00007ffff7ec383f in glp_delete_prob () from /usr/lib/libglpk.so.40
#9  0x0000555555e2d576 in caml_empty_minor_heap () at minor_gc.c:386
#10 0x0000555555e2d9eb in caml_gc_dispatch () at minor_gc.c:443
#11 0x0000555555e2a42b in caml_garbage_collection () at signals_asm.c:78
#12 0x0000555555e443cc in caml_call_gc ()
#13 0x0000555555daa54f in camlLwt__return_8726 () at src/core/lwt.ml:1503
#14 0x0000555555dac620 in camlLwt__try_bind_33005 () at src/core/lwt.ml:2135
#15 0x0000555555daafbe in camlLwt__callback_13871 () at src/core/lwt.ml:1866
#16 0x0000555555da9ab8 in camlLwt__iter_callback_list_4529 () at src/core/lwt.ml:1209
#17 0x0000555555da9c29 in camlLwt__run_in_resolution_loop_4573 () at src/core/lwt.ml:1275
#18 0x0000555555da9dd7 in camlLwt__resolve_4591 () at src/core/lwt.ml:1311
#19 0x0000555555daafdf in camlLwt__callback_13871 () at src/core/lwt.ml:1880
#20 0x0000555555da9ab8 in camlLwt__iter_callback_list_4529 () at src/core/lwt.ml:1209
#21 0x0000555555da9c29 in camlLwt__run_in_resolution_loop_4573 () at src/core/lwt.ml:1275
#22 0x0000555555da9dd7 in camlLwt__resolve_4591 () at src/core/lwt.ml:1311
#23 0x0000555555daafdf in camlLwt__callback_13871 () at src/core/lwt.ml:1880
#24 0x0000555555da9ab8 in camlLwt__iter_callback_list_4529 () at src/core/lwt.ml:1209
#25 0x0000555555da9c29 in camlLwt__run_in_resolution_loop_4573 () at src/core/lwt.ml:1275
#26 0x0000555555da9dd7 in camlLwt__resolve_4591 () at src/core/lwt.ml:1311
#27 0x0000555555daefec in camlLwt__callback_64313 () at src/core/lwt.ml:2667
#28 0x0000555555da9ae8 in camlLwt__iter_callback_list_4529 () at src/core/lwt.ml:1216
#29 0x0000555555da9c29 in camlLwt__run_in_resolution_loop_4573 () at src/core/lwt.ml:1275
#30 0x0000555555da9dd7 in camlLwt__resolve_4591 () at src/core/lwt.ml:1311
#31 0x0000555555daa02c in camlLwt__wakeup_general_4627 () at src/core/lwt.ml:1385
#32 0x0000555555da83fd in camlLwt_sequence__loop_1061 () at src/core/lwt_sequence.ml:128
#33 0x0000555555da83fd in camlLwt_sequence__loop_1061 () at src/core/lwt_sequence.ml:128
#34 0x0000555555dbd1e1 in camlList__iter_1083 () at list.ml:100
#35 0x0000555555a6c8c4 in camlLwt_engine__fun_3023 () at src/unix/lwt_engine.ml:357
#36 0x0000555555a6eeec in camlLwt_main__run_1127 () at src/unix/lwt_main.ml:33
smimram commented 5 years ago

Last commit might help (although it is not very likely).

c-cube commented 5 years ago

doesn't seem to help :(

wtipton commented 3 years ago

I believe this is due to glp_delete_prob getting run from a different thread than the one that created the problem. GLPK doesn't support this because it keeps memory allocator data in thread local storage. I believe you can work around this by compiling GLPK with ./configure --disable-reentrant.