Tarantool child process crashes on crypto module loading on MacOS
I've tried to build and play with picodata on macos, but failed.
- There was a linking error in build.rs (fixed in this branch)
- After solving this problem I have tried to start picodata bunary, but it immediately crashed. The problem is in the child Tarantool process that loads
crypto
module on the startup
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 4.1
* frame #0: 0x000000010f099f07 picodata`jit_secure_call(L=0x0000000112bbe378, base=0x0000000112bf8780, nres=2) at lj_api.c:88:14
frame #1: 0x000000010f0a20b2 picodata`lua_call(L=0x0000000112bbe378, nargs=1, nresults=1) at lj_api.c:1138:3
frame #2: 0x000000010ecbeba7 picodata`tarantool_lua_init(tarantool_bin="/Users/darthunix/git/picodata/target/debug/picodata", argc=1, argv=0x00007fdbbb804120) at init.c:782:3
frame #3: 0x000000010ecac63c picodata`::tarantool_main(argc=1, argv=0x00007fdbbb804120, cb=(picodata`picodata::main_run::trampoline::h1a8e876c200365b7 at main.rs:37), cb_data=0x00007fdbba705d20)(void *), void *) at main.cc:778:2
frame #4: 0x000000010e6da0d1 picodata`picodata::main_run::hfb6250a4e3774823(args=Run @ 0x00007ff7b182b198) at main.rs:118:26
frame #5: 0x000000010e6d9574 picodata`picodata::main::h95476c0af6274efb at main.rs:17:38
frame #6: 0x000000010e6d784e picodata`core::ops::function::FnOnce::call_once::h8731f1a9520f0125((null)=(picodata`picodata::main::h95476c0af6274efb at main.rs:15), (null)=<unavailable>) at function.rs:251:5
frame #7: 0x000000010e6ff561 picodata`std::sys_common::backtrace::__rust_begin_short_backtrace::h63d0ab67f26d3b1e(f=(picodata`picodata::main::h95476c0af6274efb at main.rs:15)) at backtrace.rs:121:18
frame #8: 0x000000010e6ff704 picodata`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hd5c9139a891702ae at rt.rs:166:18
frame #9: 0x000000010fa058e4 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h61195f273fbb2744 at function.rs:286:13 [opt]
frame #10: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::do_call::h742c41daae50fa78 at panicking.rs:483:40 [opt]
frame #11: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::h289fd06090f9252d at panicking.rs:447:19 [opt]
frame #12: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panic::catch_unwind::h442e40ac2db064f5 at panic.rs:137:14 [opt]
frame #13: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::haebd6112c3b7ec52 at rt.rs:148:48 [opt]
frame #14: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::do_call::h5621965127b9aadb at panicking.rs:483:40 [opt]
frame #15: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::h55c66b03bc020b32 at panicking.rs:447:19 [opt]
frame #16: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panic::catch_unwind::hf00d6becf2cfdae2 at panic.rs:137:14 [opt]
frame #17: 0x000000010fa058e1 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 at rt.rs:148:20 [opt]
frame #18: 0x000000010e6ff6d7 picodata`std::rt::lang_start::h3b5e2613112435fa(main=(picodata`picodata::main::h95476c0af6274efb at main.rs:15), argc=8, argv=0x00007ff7b182b840, sigpipe='\0') at rt.rs:165:17
frame #19: 0x000000010e6dafc8 picodata`main + 24
frame #20: 0x00007ff80a840310 dyld`start + 2432
(lldb) p *base
(TValue) $36 = {
u64 = 18446744073709551615
n = NaN
gcr = (gcptr64 = 18446744073709551615)
it64 = -1
= (i = -1, it = 4294967295)
ftsz = -1
u32 = (lo = 4294967295, hi = 4294967295)
}
An attempt to call lj_vm_call(L, base, nres)
static void jit_secure_call(lua_State *L, TValue *base, int nres) {
global_State *g = G(L);
/* Forbid Lua world re-entrancy while running the trace */
if (tvref(g->jit_base)) {
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_JITCALL));
if (g->panic) g->panic(L);
exit(EXIT_FAILURE);
}
lj_trace_abort(g); /* Never record across Lua VM entrance */
lj_vm_call(L, base, nres);
}
produces SIGABRT and the stack is flushed (thanks to lj_trace_abort(g)
I guess)
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007ff80ab3930e libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007ff80ab70f7b libsystem_pthread.dylib`pthread_kill + 263
frame #2: 0x00007ff80aabaca5 libsystem_c.dylib`abort + 123
frame #3: 0x000000010fa14829 picodata`std::sys::unix::abort_internal::h61289b82f0c5e310 at mod.rs:347:14 [opt]
frame #4: 0x000000010fa1098f picodata`__rust_foreign_exception at panicking.rs:71:5 [opt]
frame #5: 0x000000010fa1a30f picodata`__rust_panic_cleanup [inlined] panic_unwind::real_imp::cleanup::hac14006794eccea2 at gcc.rs:0 [opt]
frame #6: 0x000000010fa1a305 picodata`__rust_panic_cleanup at lib.rs:96:19 [opt]
frame #7: 0x000000010fa05bbe picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::cleanup::h161f7d1121c79033 at panicking.rs:464:42 [opt]
frame #8: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::do_catch::hf5e0f1cc6d81a136 at panicking.rs:508:23 [opt]
frame #9: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::h289fd06090f9252d at panicking.rs:447:19 [opt]
frame #10: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panic::catch_unwind::h442e40ac2db064f5 at panic.rs:137:14 [opt]
frame #11: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::haebd6112c3b7ec52 at rt.rs:148:48 [opt]
frame #12: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::do_call::h5621965127b9aadb at panicking.rs:483:40 [opt]
frame #13: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panicking::try::h55c66b03bc020b32 at panicking.rs:447:19 [opt]
frame #14: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 [inlined] std::panic::catch_unwind::hf00d6becf2cfdae2 at panic.rs:137:14 [opt]
frame #15: 0x000000010fa05bb6 picodata`std::rt::lang_start_internal::h9ca2efac34d80f78 at rt.rs:148:20 [opt]
frame #16: 0x000000010e6ff6d7 picodata`std::rt::lang_start::h3b5e2613112435fa(main=(picodata`picodata::main::h95476c0af6274efb at main.rs:15), argc=8, argv=0x00007ff7b182b840, sigpipe='\0') at rt.rs:165:17
frame #17: 0x000000010e6dafc8 picodata`main + 24
frame #18: 0x00007ff80a840310 dyld`start + 2432
I have migrated submodule with its patches to 2.10.5-picodata, but the problem is still the same.