Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KJTsanaktsidis/11df4ab633f63c3c1a2f1bca55a88ce9 to your computer and use it in GitHub Desktop.
Save KJTsanaktsidis/11df4ab633f63c3c1a2f1bca55a88ce9 to your computer and use it in GitHub Desktop.
FreeBSD fork/thread deadlock
(gdb) info threads
Id Target Id Frame
* 1 LWP 100729 of process 15250 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
2 LWP 105716 of process 15250 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
(gdb) thread 1
[Switching to thread 1 (LWP 100729 of process 15250)]
#0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
40 in /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S
(gdb) bt
#0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
#1 0x000030e4b6279690 in __thr_rwlock_wrlock (rwlock=0x30e4b627db80, tsp=<optimized out>) at /usr/src/lib/libthr/thread/thr_umtx.c:327
#2 0x000030e4b6273df1 in _thr_rwlock_wrlock (rwlock=<optimized out>, tsp=<optimized out>) at /usr/src/lib/libthr/thread/thr_umtx.h:241
#3 _thr_rtld_wlock_acquire (lock=0x30e4b627db80) at /usr/src/lib/libthr/thread/thr_rtld.c:143
#4 0x00005692625a123f in wlock_acquire (lock=0x5692625ad8a0 <rtld_locks>, lockstate=<optimized out>) at /usr/src/libexec/rtld-elf/rtld_lock.c:276
#5 _rtld_atfork_pre (locks=0x30e4b06f9390) at /usr/src/libexec/rtld-elf/rtld_lock.c:477
#6 0x000030e4b626d694 in thr_fork_impl (a=a@entry=0x30e4b06f93f8) at /usr/src/lib/libthr/thread/thr_fork.c:195
#7 0x000030e4b626d5d8 in __thr_fork () at /usr/src/lib/libthr/thread/thr_fork.c:314
#8 0x000030e4b51dc248 in daemonfd (chdirfd=chdirfd@entry=-1, nullfd=nullfd@entry=-1) at /usr/src/lib/libc/gen/daemon.c:61
#9 0x000030e4b51dc337 in daemon (nochdir=nochdir@entry=1, noclose=noclose@entry=1) at /usr/src/lib/libc/gen/daemon.c:110
#10 0x000030dc90459fb8 in rb_daemon (nochdir=1, noclose=1) at process.c:6851
#11 proc_daemon (argc=<optimized out>, argv=0x30e4bdb38dc8, _=<optimized out>) at process.c:6840
#12 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#13 0x000030dc90524b27 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4d8a05230, block_handler=0, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#14 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:835
#15 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050) at vm.c:2603
#16 0x000030dc9054b7b2 in invoke_iseq_block_from_c (ec=0x30e4bdb32050, captured=<optimized out>, self=0, argc=<optimized out>, argv=<optimized out>, kw_splat=<optimized out>,
passed_block_handler=<optimized out>, cref=0x0, is_lambda=0, me=0x0) at ./vm_insnhelper.c:391
#17 invoke_block_from_c_bh (ec=0x30e4bdb32050, block_handler=<optimized out>, argc=<optimized out>, argv=<optimized out>, kw_splat=kw_splat@entry=0, passed_block_handler=passed_block_handler@entry=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1474
#18 0x000030dc90530e24 in rb_yield (val=<optimized out>, val@entry=4) at vm.c:1511
#19 0x000030dc903d868b in popen_finish (port=<optimized out>, klass=53759230289920) at io.c:7967
#20 rb_io_s_popen (argc=<optimized out>, argv=0x30e4bdb38d78, klass=53759230289920) at io.c:7921
#21 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#22 0x000030dc90524a19 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4d8a808c0, block_handler=<optimized out>, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#23 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:815
#24 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050) at vm.c:2603
#25 0x000030dc9054b7b2 in invoke_iseq_block_from_c (ec=0x30e4bdb32050, captured=<optimized out>, self=0, argc=<optimized out>, argv=<optimized out>, kw_splat=<optimized out>,
passed_block_handler=<optimized out>, cref=0x0, is_lambda=0, me=0x0) at ./vm_insnhelper.c:391
#26 invoke_block_from_c_bh (ec=0x30e4bdb32050, block_handler=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x30e4b06f9d18, kw_splat=kw_splat@entry=0, passed_block_handler=passed_block_handler@entry=0,
cref=0x0, is_lambda=<optimized out>, force_blockarg=0) at vm.c:1474
#27 0x000030dc9054abb4 in vm_yield_with_cref (ec=0x30e4b627db80, argc=1, argv=0x30e4b06f9d18, kw_splat=0, cref=0x0, is_lambda=0) at vm.c:1511
#28 vm_yield (ec=0x30e4b627db80, argc=1, argv=0x30e4b06f9d18, kw_splat=0) at vm.c:1519
#29 rb_yield_0 (argc=1, argv=0x30e4b06f9d18) at ./vm_eval.c:1359
#30 catch_i (tag=53759550141240, _=<optimized out>, argc=<optimized out>, argv=<optimized out>, blockarg=<optimized out>) at ./vm_eval.c:2264
#31 0x000030dc905332be in vm_catch_protect (tag=53759550141240, func=0x30dc9054ab40 <catch_i>, data=13, data@entry=0, stateptr=stateptr@entry=0x30e4b06f9e14, ec=0x30e4bdb32050) at ./vm_eval.c:2346
#32 0x000030dc90533b22 in rb_catch_obj (t=53758866742144, func=0xd, data=0) at ./vm_eval.c:2372
#33 rb_f_catch (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at ./vm_eval.c:2322
#34 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#35 0x000030dc90524a19 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4c399c660, block_handler=<optimized out>, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#36 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:815
#37 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050) at vm.c:2603
#38 0x000030dc9054b7b2 in invoke_iseq_block_from_c (ec=0x30e4bdb32050, captured=<optimized out>, self=0, argc=<optimized out>, argv=<optimized out>, kw_splat=<optimized out>,
passed_block_handler=<optimized out>, cref=0x0, is_lambda=0, me=0x0) at ./vm_insnhelper.c:391
--Type <RET> for more, q to quit, c to continue without paging--
#39 invoke_block_from_c_bh (ec=0x30e4bdb32050, block_handler=<optimized out>, argc=<optimized out>, argv=<optimized out>, kw_splat=kw_splat@entry=0, passed_block_handler=passed_block_handler@entry=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1474
#40 0x000030dc90530e24 in rb_yield (val=<optimized out>) at vm.c:1511
#41 0x000030dc90308b43 in rb_ary_collect (ary=53759550159760) at array.c:3745
#42 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#43 0x000030dc90524a19 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4d89138d0, block_handler=<optimized out>, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#44 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:815
#45 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050) at vm.c:2603
#46 0x000030dc9054b7b2 in invoke_iseq_block_from_c (ec=0x30e4bdb32050, captured=<optimized out>, self=0, argc=<optimized out>, argv=<optimized out>, kw_splat=<optimized out>,
passed_block_handler=<optimized out>, cref=0x0, is_lambda=0, me=0x0) at ./vm_insnhelper.c:391
#47 invoke_block_from_c_bh (ec=0x30e4bdb32050, block_handler=<optimized out>, argc=<optimized out>, argv=<optimized out>, kw_splat=kw_splat@entry=0, passed_block_handler=passed_block_handler@entry=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1474
#48 0x000030dc90530e24 in rb_yield (val=<optimized out>) at vm.c:1511
#49 0x000030dc90302537 in rb_ary_each (ary=53759409061480) at array.c:2653
#50 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#51 0x000030dc90524a19 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4c3aa0c40, block_handler=<optimized out>, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#52 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:815
#53 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050) at vm.c:2603
#54 0x000030dc9054b7b2 in invoke_iseq_block_from_c (ec=0x30e4bdb32050, captured=<optimized out>, self=0, argc=<optimized out>, argv=<optimized out>, kw_splat=<optimized out>,
passed_block_handler=<optimized out>, cref=0x0, is_lambda=0, me=0x0) at ./vm_insnhelper.c:391
#55 invoke_block_from_c_bh (ec=0x30e4bdb32050, block_handler=<optimized out>, argc=<optimized out>, argv=<optimized out>, kw_splat=kw_splat@entry=0, passed_block_handler=passed_block_handler@entry=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1474
#56 0x000030dc90530e24 in rb_yield (val=<optimized out>) at vm.c:1511
#57 0x000030dc90302537 in rb_ary_each (ary=53759374819800) at array.c:2653
#58 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#59 0x000030dc90524a19 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4c3b3a7e0, block_handler=<optimized out>, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#60 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:815
#61 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050, ec@entry=0x30e4d3f52b50) at vm.c:2603
#62 0x000030dc905380d9 in rb_iseq_eval (iseq=iseq@entry=0x30e4d3f51fe8) at vm.c:2632
#63 0x000030dc903fcf99 in load_iseq_eval (ec=ec@entry=0x30e4bdb32050, fname=fname@entry=53759366736720) at load.c:711
#64 0x000030dc903fb30c in require_internal (ec=0x30e4b627db80, ec@entry=0x30e4bdb32050, fname=<optimized out>, fname@entry=53759366736760, exception=exception@entry=1, warn=false) at load.c:1217
#65 0x000030dc903fa770 in rb_require_string (fname=53759366736760) at load.c:1310
#66 rb_f_require_relative (obj=<optimized out>, fname=<optimized out>) at load.c:972
#67 0x000030dc90542ac0 in vm_call_cfunc_with_frame_ (ec=0x30e4bdb32050, reg_cfp=<optimized out>, calling=<optimized out>, argc=<optimized out>, argv=<optimized out>, stack_bottom=<optimized out>)
at ./vm_insnhelper.c:3433
#68 0x000030dc90524b27 in vm_sendish (ec=0x30e4bdb32050, cd=0x30e4c3b40730, block_handler=0, method_explorer=mexp_search_method, reg_cfp=<optimized out>) at ./vm_insnhelper.c:5487
#69 vm_exec_core (ec=ec@entry=0x30e4bdb32050, initial=initial@entry=0) at insns.def:835
#70 0x000030dc90537dfb in rb_vm_exec (ec=0x30e4bdb32050, ec@entry=0x0) at vm.c:2603
#71 0x000030dc905381f4 in rb_iseq_eval_main (iseq=iseq@entry=0x30e4d3f53758) at vm.c:2643
#72 0x000030dc902f66aa in rb_ec_exec_node (ec=ec@entry=0x30e4bdb32050, n=0x30e4b627db80, n@entry=0x30e4d3f53758) at eval.c:295
#73 0x000030dc902f651c in ruby_run_node (n=0x30e4d3f53758) at eval.c:336
#74 0x000030dc902f3c67 in rb_main (argc=5, argv=0x30e4b06fb408) at ./main.c:39
#75 main (argc=5, argv=0x30e4b06fb408) at ./main.c:58
(gdb) thread 2
[Switching to thread 2 (LWP 105716 of process 15250)]
#0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
40 in /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S
(gdb) bt
#0 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:40
#1 0x000030e4b62790ec in __thr_umutex_lock (mtx=0x30e4bdad3020, id=105716) at /usr/src/lib/libthr/thread/thr_umtx.c:82
#2 0x000030e4b627181c in mutex_lock_sleep (curthread=0x30e4d8a56100, m=0x30e4bdad3020, abstime=<optimized out>) at /usr/src/lib/libthr/thread/thr_mutex.c:702
#3 mutex_lock_common (m=0x30e4bdad3020, abstime=<optimized out>, cvattach=false, rb_onlist=false) at /usr/src/lib/libthr/thread/thr_mutex.c:736
#4 0x000030e4b52f6ddb in malloc_mutex_lock_final (mutex=0x30e4bc603238) at /usr/src/contrib/jemalloc/include/jemalloc/internal/mutex.h:153
#5 __je_malloc_mutex_lock_slow (mutex=0x30e4bc603238) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_mutex.c:96
#6 0x000030e4b52f2617 in malloc_mutex_lock (tsdn=tsdn@entry=0x30e4bb586090, mutex=0x30e4bc603238, mutex@entry=0x30e4bb586090) at /usr/src/contrib/jemalloc/include/jemalloc/internal/mutex.h:219
#7 extent_deactivate (tsdn=tsdn@entry=0x30e4bb586090, arena=<optimized out>, extents=extents@entry=0x30e4bc603238, extent=0x30e4bc61dd00) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_extent.c:684
#8 0x000030e4b52ed71d in extent_recycle_split (tsdn=0x30e4bb586090, arena=0x30e4bc600980, r_extent_hooks=0x30e4e138dba8, rtree_ctx=0x30e4bb5860c0, extents=0x30e4bc603238, size=28672, extent=0x30e4bc61dc80,
growing_retained=<optimized out>, new_addr=<optimized out>, pad=<optimized out>, alignment=<optimized out>, slab=<optimized out>, szind=<optimized out>)
at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_extent.c:1087
#9 extent_recycle (tsdn=0x30e4bb586090, arena=0x30e4bc600980, r_extent_hooks=0x30e4e138dba8, extents=0x30e4bc603238, new_addr=<optimized out>, size=28672, pad=4096, alignment=64, slab=<optimized out>,
szind=39, zero=0x30e4e138dbff, commit=0x30e4e138dba7, growing_retained=<optimized out>) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_extent.c:1148
#10 0x000030e4b52ed039 in __je_extents_alloc (tsdn=0x30e4bdad3020, arena=0x11, r_extent_hooks=0x0, extents=0x0, new_addr=0x0, size=0, pad=4096, alignment=64, slab=<optimized out>, szind=39, zero=0x30e4e138dbff,
commit=0x30e4e138dba7) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_extent.c:545
#11 0x000030e4b52c9fbd in __je_arena_extent_alloc_large (tsdn=0x30e4bb586090, arena=0x30e4bc600980, usize=28672, alignment=64, zero=0x30e4e138dbff) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_arena.c:438
#12 0x000030e4b52f39e5 in __je_large_palloc (tsdn=0x30e4bb586090, arena=<optimized out>, usize=28672, alignment=64, zero=<optimized out>) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_large.c:47
#13 0x000030e4b530cb83 in ipallocztm (tsdn=0x30e4bb586090, usize=28672, alignment=64, zero=true, tcache=0x0, is_internal=true, arena=0x11)
at /usr/src/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:78
#14 __je_tsd_tcache_data_init (tsd=tsd@entry=0x30e4bb586090) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_tcache.c:451
#15 0x000030e4b530caba in __je_tsd_tcache_enabled_data_init (tsd=0x30e4bb586090) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_tcache.c:402
#16 0x000030e4b530fa3a in __je_tsd_fetch_slow (tsd=0x30e4bb586090, minimal=<optimized out>) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd_malloc_thread_cleanup.h:60
#17 0x000030e4b52be31b in tsd_fetch_impl (init=true, minimal=false) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:355
#18 tsd_fetch () at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:381
#19 imalloc (sopts=<optimized out>, dopts=<optimized out>) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_jemalloc.c:2256
#20 __je_malloc_default (size=64) at /usr/obj/usr/src/amd64.amd64/lib/libc/jemalloc_jemalloc.c:2293
#21 0x000030e4b626a464 in _thr_attr_init (attr=attr@entry=0x30e4e138df08) at /usr/src/lib/libthr/thread/thr_attr.c:365
#22 0x000030dc904e60a1 in get_stack (addr=0x30e4e138df00, size=0x30e4e138def8) at ./thread_pthread.c:814
#23 native_thread_init_stack (th=th@entry=0x30e4c39cfa40) at ./thread_pthread.c:1049
#24 0x000030dc904ef961 in thread_start_func_1 (th_ptr=<optimized out>) at ./thread_pthread.c:1085
#25 0x000030e4b626ca7a in thread_start (curthread=0x30e4d8a56100) at /usr/src/lib/libthr/thread/thr_create.c:292
#26 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x30e4e138e000
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment