fix: lua stack overflow
Previously, there were some places in the code where we created an isolated Lua state with a Lua thread without deleting it from the Lua stack after the thread has finished. This led to a stack overflow and a crash of the whole application.
Overflow backtrace:
1 0x55fd211aeabd in tarantool_panic_handler+557
2 0x55fd2135c07f in lj_err_throw+639
3 0x55fd2135d622 in lj_err_run+3970
4 0x55fd2135e7f6 in err_msgv+1398
5 0x55fd2135e272 in lj_err_msg+50
6 0x55fd21390e85 in lj_state_growstack+597
7 0x55fd21390ea3 in lj_state_growstack1+19
8 0x55fd2133138f in lua_newthread+1855
9 0x7fc86663133e in tarantool::session::uid::h94d3a7ceec42ce57+46
10 0x7fc866651996 in tarantool::schema::space::create_space::ha03ad5d9e2c5a0d9+246
11 0x7fc866640121 in tarantool::space::Space::create::h7b1cb4c3eb1dd2c0+33
12 0x7fc8665c189a in harder::space::TmpSpace::initialize::h7ab1c8a009cdd40e+650
13 0x7fc8665c683d in harder::harder::__tp_inner::h4b099b0350f1abec+45
14 0x7fc8665c64a4 in harder+340
15 0x55fd20c1249a in module_func_call+826
16 0x55fd20dde955 in func_c_call+389
17 0x55fd20ddf930 in func_call_no_access_check+592
18 0x55fd20f3e66c in box_process_call+972
19 0x55fd20b4b7ee in tx_process_call(cmsg*)+846
20 0x55fd2123566e in cmsg_deliver+190
21 0x55fd2123a294 in fiber_pool_f+1396
22 0x55fd20b3ac6a in fiber_cxx_invoke(int (*)(__va_list_tag*), __va_list_tag*)+26
23 0x55fd21221a95 in fiber_loop+325
24 0x55fd21cf3ebc in coro_init+332
2023-02-04 20:11:29.374 [60317] main/136/main C> stack overflow
More funny stacks can be found at sbroad#337 (closed)