This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Commit 52bb62c
committed
fix: lua state trampolines should be "C-unwind", not "C"
This is due to the fact that lua_error calls _Unwind_RaiseException
under the hood, which causes rust's extern "C" functions to misbehave
when an exception passes through their frame.
Without this change we crash with a following log:
```
i1 | 2024-10-09 02:13:28.940 [120075] main/111/main C> panicked at library/core/src/panicking.rs:221:5:
i1 | panic in a function that cannot unwind
i1 | 2024-10-09 02:13:28.940 [120075] main/111/main C> backtrace:
i1 | disabled backtrace
i1 | 2024-10-09 02:13:28.940 [120075] main/111/main C> aborting due to panic
i1 | [supervisor:120065] no ipc message from child
i1 | [supervisor:120065] subprocess 120075 was signaled with SIGABRT
i1 | [supervisor:120065] core dumped
```
picodata repro:
```shell
pipenv run pytest -k test_submit_sql_after_revoke
```
backtrace:
```
#0 0x00007e04dc2a53f4 in ?? () from /usr/lib/libc.so.6
#1 0x00007e04dc24c120 in raise () from /usr/lib/libc.so.6
#2 0x00007e04dc2334c3 in abort () from /usr/lib/libc.so.6
#3 0x0000000005961a6a in std::sys::pal::unix::abort_internal () at library/std/src/sys/pal/unix/mod.rs:370
#4 0x0000000001e3227a in std::process::abort () at library/std/src/process.rs:2388
#5 0x0000000002e2d476 in picodata::cli::run::main::{closure#0}::{closure#1} (info=0x7e04bb8800f8) at src/cli/run.rs:120
#6 0x000000000595691f in alloc::boxed::{impl#50}::call<(&std::panic::PanicHookInfo), (dyn core::ops::function::Fn<(&std::panic::PanicHookInfo), Output=()> + core::marker::Send + core::marker::Sync), alloc::alloc::Global> ()
at library/alloc/src/boxed.rs:2084
#7 std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:808
#8 0x0000000005956513 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/panicking.rs:667
#9 0x0000000005953c99 in std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure_env#0}, !> () at library/std/src/sys/backtrace.rs:168
#10 0x00000000059561d4 in std::panicking::begin_panic_handler () at library/std/src/panicking.rs:665
#11 0x0000000001e34e35 in core::panicking::panic_nounwind_fmt::runtime () at library/core/src/panicking.rs:112
#12 core::panicking::panic_nounwind_fmt () at library/core/src/panicking.rs:122
#13 0x0000000001e34ec2 in core::panicking::panic_nounwind () at library/core/src/panicking.rs:221
#14 0x0000000001e350e6 in core::panicking::panic_cannot_unwind () at library/core/src/panicking.rs:309
#15 0x0000000002c17f7a in tlua::functions_write::wrapper<tlua::functions_write::Function<picodata::set_login_check::{closure_env#1}, (alloc::string::String, bool, *mut tlua::ffi::lua_State), ()>, (alloc::string::String, bool, *mut tlua::ffi::lua_State), ()> (lua=0x40c2cc90) at tarantool/tlua/src/functions_write.rs:455
#16 0x000000000321d513 in lj_BC_FUNCC () at buildvm_x86.dasc:811
#17 0x0000000003224253 in lua_pcall (L=L@entry=0x40c2cc90, nargs=<optimized out>, nresults=nresults@entry=-1, errfunc=errfunc@entry=0) at picodata/tarantool-sys/third_party/luajit/src/lj_api.c:1172
#18 0x000000000301b47b in luaT_call (L=L@entry=0x40c2cc90, nargs=<optimized out>, nreturns=nreturns@entry=-1) at picodata/tarantool-sys/src/lua/utils.c:619
```1 parent 3eb4793 commit 52bb62c
File tree
5 files changed
+11
-11
lines changed- tarantool/src
- tlua/src
5 files changed
+11
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
898 | | - | |
| 898 | + | |
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | | - | |
| 1017 | + | |
1018 | 1018 | | |
1019 | 1019 | | |
1020 | 1020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
| 528 | + | |
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
| 553 | + | |
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
992 | | - | |
| 992 | + | |
993 | 993 | | |
994 | 994 | | |
995 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments