[Cook] deadlock in interrupt() at cook/desist.c:57

Martin Sebor msebor at gmail.com
Thu Nov 19 05:03:09 EST 2009


I've had cook deadlock on me several times. From the stack trace
and the source code it appears that it calls malloc() from a signal
handler (invoked in response to SIGINT). Since malloc() is not
async-signal safe, calling it from signal handlers is unsafe and
leads to undefined behavior.

I'd be happy to open a bug if someone can point me at the bug
tracking database for this project.

Martin

#0  0x009ae422 in __kernel_vsyscall ()
#1  0x001fde43 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x00186b94 in _L_lock_9571 () from /lib/libc.so.6
#3  0x00184bf4 in malloc () from /lib/libc.so.6
#4  0x0806fb53 in mem_alloc (n=24) at common/mem.c:81
#5  0x08072b91 in sub_context_new () at common/sub.c:205
#6  0x08050efc in interrupt (n=1) at cook/desist.c:57
#7  <signal handler called>
#8  0x009ae420 in __kernel_vsyscall ()
#9  0x001fde43 in __lll_lock_wait_private () from /lib/libc.so.6
#10 0x00186b94 in _L_lock_9571 () from /lib/libc.so.6
#11 0x00184bf4 in malloc () from /lib/libc.so.6
#12 0x0806fb53 in mem_alloc (n=24) at common/mem.c:81
#13 0x08072b91 in sub_context_new () at common/sub.c:205
#14 0x08050efc in interrupt (n=2) at cook/desist.c:57
#15 <signal handler called>
#16 0x00182571 in _int_malloc () from /lib/libc.so.6
#17 0x00184bfe in malloc () from /lib/libc.so.6
#18 0x0806fb20 in mem_change_size (p=0x0, n=64) at common/mem.c:123
#19 0x080722bb in string_list_append (wlp=0x87bade8, w=0x83c68c0)
     at common/str_list.c:60
#20 0x08063a17 in execute (op=0x83d86a0, icp=0x87bc5e8)
     at cook/opcode/string.c:111
#21 0x08061eb5 in opcode_context_execute_inner (ocp=0x87bc5e8,
     func=0x80600b0 <opcode_execute>) at cook/opcode/context.c:218
#22 0x08061f54 in opcode_context_run (ocp=0x87bc5e8, olp=0x8408bd0)
     at cook/opcode/context.c:744
#23 0x08055916 in graph_check_ingredients (gp=0x876a280, rp=0x8409198,
     preference=<value optimized out>, target=0xbfc8ca08, 
need_gfl=0xbfc8ca14,
     common_ingredients_gfl=0xbfc8cad4, implicit_allowed=1, mp=0x87bc0e8)
     at cook/graph/build.c:280
#24 0x080565da in graph_check_recipe (gp=0x876a280, rp=<value optimized 
out>,
     preference=graph_build_preference_backtrack,
     common_ingredients_gfl=0xbfc8cad4, implicit_allowed=1, mp=0x87bc0e8)
     at cook/graph/build.c:834
#25 0x08055482 in graph_build_file (gp=0x876a280,
     target=<value optimized out>, preference=<value optimized out>,
     result=<value optimized out>, implicit_allowed=1)
     at cook/graph/build.c:1715
#26 0x080559d6 in graph_check_ingredients (gp=0x876a280, rp=0x8407eb8,
     preference=<value optimized out>, target=0xbfc8cbd8, 
need_gfl=0xbfc8cbe4,
     common_ingredients_gfl=0xbfc8cca4, implicit_allowed=1, mp=0x87bc350)
     at cook/graph/build.c:375
#27 0x080565da in graph_check_recipe (gp=0x876a280, rp=<value optimized 
out>,
     preference=graph_build_preference_backtrack,
     common_ingredients_gfl=0xbfc8cca4, implicit_allowed=1, mp=0x87bc350)
     at cook/graph/build.c:834
#28 0x08055482 in graph_build_file (gp=0x876a280,
     target=<value optimized out>, preference=<value optimized out>,
     result=<value optimized out>, implicit_allowed=1)
     at cook/graph/build.c:1715
#29 0x080556d5 in graph_build (gp=0x876a280, target=0x8663580,
     preference=graph_build_preference_error, waffle=0)
     at cook/graph/build.c:2093
#30 0x0805574f in graph_build_list (gp=0x876a280, target=0x808c3e8,
     preference=graph_build_preference_error, waffle=0)
     at cook/graph/build.c:2137
#31 0x0805042f in cook_auto_required () at cook/cook.c:1017
#32 0x0805eb26 in main (argc=2, argv=0xbfc8ce54) at cook/main.c:765


More information about the Cook-users mailing list