bxq2011hust labeled issue #3571:
Thanks for filing a bug report! Please fill out the TODOs below.
Note: if you want to report a security issue, please read our security policy!
Test Case
upload Wasm file here
Steps to Reproduce
first, call a wasm function
second, in the called wasm function, call host function, host function call a function in another wasm instance, then calll a host function which return a trap to interrupt the execution and return result to first wasm call.
third, the second wasm call maybe in the same thread as the first wasm call, because we use boost coroutineExpected Results
What do you expect to happen?
just return the trap with user defined message
Actual Results
thread '<unnamed>' panicked at 'called
Option::unwrap()on a
Nonevalue', crates/runtime/src/traphandlers.rs:84:27
and wasmtime return a trap with
called
Option::unwrap()on a
Nonevalue
Versions and Environment
Wasmtime version or commit: v0.31.0
Operating system: Ubuntu 20.04
Architecture: x86_64
Extra Info
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates/runtime/src/traphandlers.rs:84:27 stack backtrace: 0: 0x55f8b0151850 - std::backtrace_rs::backtrace::libunwind::trace::hfa838fc631229987 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x55f8b0151850 - std::backtrace_rs::backtrace::trace_unsynchronized::h93a23e36ec026219 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55f8b0151850 - std::sys_common::backtrace::_print_fmt::hba56c7f796a4152f at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55f8b0151850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h214637f1e26310e1 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55f8b01be22c - core::fmt::write::h7aa6cd0067dca82a at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/fmt/mod.rs:1110:17 5: 0x55f8b01431e5 - std::io::Write::write_fmt::heb07fc0616bbd06d at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/io/mod.rs:1588:15 6: 0x55f8b01556db - std::sys_common::backtrace::_print::h2c2441c37e894fb5 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55f8b01556db - std::sys_common::backtrace::print::h4fb679ac439362ea at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55f8b01556db - std::panicking::default_hook::{{closure}}::h56bbadec2356e5d2 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:208:50 9: 0x55f8b01551b1 - std::panicking::default_hook::hb25822b45f6fdc4e at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:225:9 10: 0x55f8b0155f04 - std::panicking::rust_panic_with_hook::h4da5578e7277d2d4 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:622:17 11: 0x55f8b01559a7 - std::panicking::begin_panic_handler::{{closure}}::h003783ddb3cba4e8 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:517:13 12: 0x55f8b0151d2c - std::sys_common::backtrace::__rust_end_short_backtrace::hd138d2032731ed21 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55f8b0155939 - rust_begin_unwind at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:515:5 14: 0x55f8af240cd1 - core::panicking::panic_fmt::hbe99dddd3092ba3c at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:92:14 15: 0x55f8af240c1d - core::panicking::panic::h3de4db67bd397eb3 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:50:5 16: 0x55f8b07c98d7 - wasmtime_runtime::traphandlers::raise_user_trap::{{closure}}::h379a9d8be1f58dd1 17: 0x55f8b07c9bec - wasmtime_runtime::traphandlers::tls::with::he8d24e4beebeef49 18: 0x55f8b07c7f96 - wasmtime_runtime::traphandlers::raise_user_trap::h551a36e7a2d8cd18 19: 0x55f8b0281638 - wasmtime::trampoline::func::stub_fn::hb6d8bd05900c5561 20: 0x7fd2140a8033 - <unknown> 21: 0x7fd2140f1ddd - <unknown> 22: 0x7fd2140e6938 - <unknown> 23: 0x7fd2140eed0a - <unknown> 24: 0x7fd2140e26b3 - <unknown> 25: 0x7fd2140ee293 - <unknown> 26: 0x7fd2140a2006 - <unknown> 27: 0x55f8b07de82c - wasmtime_setjmp 28: 0x55f8b027aef6 - wasmtime_runtime::traphandlers::catch_traps::hf8385270d50bd059 29: 0x55f8b08c93bb - wasmtime::func::Func::call::hfad085cecac9e549 30: 0x55f8b0322551 - wasm_func_call 31: 0x55f8b0269fd1 - _ZN4hera11WasmcEngine7executeERN4evmc11HostContextESt17basic_string_viewIhSt11char_traitsIhEES7_RK12evmc_messageb
Maybe call two wasm instance use one thread is not permitted? or there is a problem use trap to interrupt execution?
bxq2011hust opened issue #3571:
Thanks for filing a bug report! Please fill out the TODOs below.
Note: if you want to report a security issue, please read our security policy!
Test Case
upload Wasm file here
Steps to Reproduce
first, call a wasm function
second, in the called wasm function, call host function, host function call a function in another wasm instance, then calll a host function which return a trap to interrupt the execution and return result to first wasm call.
third, the second wasm call maybe in the same thread as the first wasm call, because we use boost coroutineExpected Results
What do you expect to happen?
just return the trap with user defined message
Actual Results
thread '<unnamed>' panicked at 'called
Option::unwrap()on a
Nonevalue', crates/runtime/src/traphandlers.rs:84:27
and wasmtime return a trap with
called
Option::unwrap()on a
Nonevalue
Versions and Environment
Wasmtime version or commit: v0.31.0
Operating system: Ubuntu 20.04
Architecture: x86_64
Extra Info
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates/runtime/src/traphandlers.rs:84:27 stack backtrace: 0: 0x55f8b0151850 - std::backtrace_rs::backtrace::libunwind::trace::hfa838fc631229987 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x55f8b0151850 - std::backtrace_rs::backtrace::trace_unsynchronized::h93a23e36ec026219 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55f8b0151850 - std::sys_common::backtrace::_print_fmt::hba56c7f796a4152f at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55f8b0151850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h214637f1e26310e1 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55f8b01be22c - core::fmt::write::h7aa6cd0067dca82a at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/fmt/mod.rs:1110:17 5: 0x55f8b01431e5 - std::io::Write::write_fmt::heb07fc0616bbd06d at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/io/mod.rs:1588:15 6: 0x55f8b01556db - std::sys_common::backtrace::_print::h2c2441c37e894fb5 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55f8b01556db - std::sys_common::backtrace::print::h4fb679ac439362ea at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55f8b01556db - std::panicking::default_hook::{{closure}}::h56bbadec2356e5d2 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:208:50 9: 0x55f8b01551b1 - std::panicking::default_hook::hb25822b45f6fdc4e at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:225:9 10: 0x55f8b0155f04 - std::panicking::rust_panic_with_hook::h4da5578e7277d2d4 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:622:17 11: 0x55f8b01559a7 - std::panicking::begin_panic_handler::{{closure}}::h003783ddb3cba4e8 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:517:13 12: 0x55f8b0151d2c - std::sys_common::backtrace::__rust_end_short_backtrace::hd138d2032731ed21 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55f8b0155939 - rust_begin_unwind at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:515:5 14: 0x55f8af240cd1 - core::panicking::panic_fmt::hbe99dddd3092ba3c at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:92:14 15: 0x55f8af240c1d - core::panicking::panic::h3de4db67bd397eb3 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:50:5 16: 0x55f8b07c98d7 - wasmtime_runtime::traphandlers::raise_user_trap::{{closure}}::h379a9d8be1f58dd1 17: 0x55f8b07c9bec - wasmtime_runtime::traphandlers::tls::with::he8d24e4beebeef49 18: 0x55f8b07c7f96 - wasmtime_runtime::traphandlers::raise_user_trap::h551a36e7a2d8cd18 19: 0x55f8b0281638 - wasmtime::trampoline::func::stub_fn::hb6d8bd05900c5561 20: 0x7fd2140a8033 - <unknown> 21: 0x7fd2140f1ddd - <unknown> 22: 0x7fd2140e6938 - <unknown> 23: 0x7fd2140eed0a - <unknown> 24: 0x7fd2140e26b3 - <unknown> 25: 0x7fd2140ee293 - <unknown> 26: 0x7fd2140a2006 - <unknown> 27: 0x55f8b07de82c - wasmtime_setjmp 28: 0x55f8b027aef6 - wasmtime_runtime::traphandlers::catch_traps::hf8385270d50bd059 29: 0x55f8b08c93bb - wasmtime::func::Func::call::hfad085cecac9e549 30: 0x55f8b0322551 - wasm_func_call 31: 0x55f8b0269fd1 - _ZN4hera11WasmcEngine7executeERN4evmc11HostContextESt17basic_string_viewIhSt11char_traitsIhEES7_RK12evmc_messageb
Maybe call two wasm instance use one thread is not permitted? or there is a problem use trap to interrupt execution?
bjorn3 commented on issue #3571:
Boost coroutines don't save and restore the required TLS variables. If you want to interleave multiple wasm module executions on the same thread you will have to use rust async and the dedicated api for wasmtime's async support. This saves and restores all TLS variables as necessafy and switches the wasm stack for you. See https://github.com/bytecodealliance/wasmtime/blob/06a93d33462f5460a1c5289f4001ccde49bf562d/crates/wasmtime/src/store.rs#L1259 and the https://github.com/bytecodealliance/wasmtime/blob/main/examples/tokio/main.rs example.
bxq2011hust commented on issue #3571:
Boost coroutines don't save and restore the required TLS variables. If you want to interleave multiple wasm module executions on the same thread you will have to use rust async and the dedicated api for wasmtime's async support. This saves and restores all TLS variables as necessafy and switches the wasm stack for you. See
and the https://github.com/bytecodealliance/wasmtime/blob/main/examples/tokio/main.rs example.
ok, got it, thanks
bxq2011hust closed issue #3571:
Thanks for filing a bug report! Please fill out the TODOs below.
Note: if you want to report a security issue, please read our security policy!
Test Case
upload Wasm file here
Steps to Reproduce
first, call a wasm function
second, in the called wasm function, call host function, host function call a function in another wasm instance, then calll a host function which return a trap to interrupt the execution and return result to first wasm call.
third, the second wasm call maybe in the same thread as the first wasm call, because we use boost coroutineExpected Results
What do you expect to happen?
just return the trap with user defined message
Actual Results
thread '<unnamed>' panicked at 'called
Option::unwrap()on a
Nonevalue', crates/runtime/src/traphandlers.rs:84:27
and wasmtime return a trap with
called
Option::unwrap()on a
Nonevalue
Versions and Environment
Wasmtime version or commit: v0.31.0
Operating system: Ubuntu 20.04
Architecture: x86_64
Extra Info
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates/runtime/src/traphandlers.rs:84:27 stack backtrace: 0: 0x55f8b0151850 - std::backtrace_rs::backtrace::libunwind::trace::hfa838fc631229987 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x55f8b0151850 - std::backtrace_rs::backtrace::trace_unsynchronized::h93a23e36ec026219 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55f8b0151850 - std::sys_common::backtrace::_print_fmt::hba56c7f796a4152f at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55f8b0151850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h214637f1e26310e1 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55f8b01be22c - core::fmt::write::h7aa6cd0067dca82a at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/fmt/mod.rs:1110:17 5: 0x55f8b01431e5 - std::io::Write::write_fmt::heb07fc0616bbd06d at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/io/mod.rs:1588:15 6: 0x55f8b01556db - std::sys_common::backtrace::_print::h2c2441c37e894fb5 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55f8b01556db - std::sys_common::backtrace::print::h4fb679ac439362ea at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55f8b01556db - std::panicking::default_hook::{{closure}}::h56bbadec2356e5d2 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:208:50 9: 0x55f8b01551b1 - std::panicking::default_hook::hb25822b45f6fdc4e at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:225:9 10: 0x55f8b0155f04 - std::panicking::rust_panic_with_hook::h4da5578e7277d2d4 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:622:17 11: 0x55f8b01559a7 - std::panicking::begin_panic_handler::{{closure}}::h003783ddb3cba4e8 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:517:13 12: 0x55f8b0151d2c - std::sys_common::backtrace::__rust_end_short_backtrace::hd138d2032731ed21 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55f8b0155939 - rust_begin_unwind at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:515:5 14: 0x55f8af240cd1 - core::panicking::panic_fmt::hbe99dddd3092ba3c at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:92:14 15: 0x55f8af240c1d - core::panicking::panic::h3de4db67bd397eb3 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:50:5 16: 0x55f8b07c98d7 - wasmtime_runtime::traphandlers::raise_user_trap::{{closure}}::h379a9d8be1f58dd1 17: 0x55f8b07c9bec - wasmtime_runtime::traphandlers::tls::with::he8d24e4beebeef49 18: 0x55f8b07c7f96 - wasmtime_runtime::traphandlers::raise_user_trap::h551a36e7a2d8cd18 19: 0x55f8b0281638 - wasmtime::trampoline::func::stub_fn::hb6d8bd05900c5561 20: 0x7fd2140a8033 - <unknown> 21: 0x7fd2140f1ddd - <unknown> 22: 0x7fd2140e6938 - <unknown> 23: 0x7fd2140eed0a - <unknown> 24: 0x7fd2140e26b3 - <unknown> 25: 0x7fd2140ee293 - <unknown> 26: 0x7fd2140a2006 - <unknown> 27: 0x55f8b07de82c - wasmtime_setjmp 28: 0x55f8b027aef6 - wasmtime_runtime::traphandlers::catch_traps::hf8385270d50bd059 29: 0x55f8b08c93bb - wasmtime::func::Func::call::hfad085cecac9e549 30: 0x55f8b0322551 - wasm_func_call 31: 0x55f8b0269fd1 - _ZN4hera11WasmcEngine7executeERN4evmc11HostContextESt17basic_string_viewIhSt11char_traitsIhEES7_RK12evmc_messageb
Maybe call two wasm instance use one thread is not permitted? or there is a problem use trap to interrupt execution?
bxq2011hust commented on issue #3571:
hello, I use the rust wrapper wasmtime's async interface
instantiate_async
andcall_async
, also called by boost coroutines, but still got the same error when host function returns a Trap. Any suggestions?Process 99864 resuming thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/baixingqiang/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.40.1/src/traphandlers.rs:84:22 stack backtrace: 0: 0x100615a28 - std::backtrace_rs::backtrace::libunwind::trace::h131b1d2b50b7c0eb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 1: 0x100615a28 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ef9f6d47e4a5c40 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x100615a28 - std::sys_common::backtrace::_print_fmt::hae9bffa833e2d615 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:66:5 3: 0x100615a28 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h53309d90f6cc2c13 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:45:22 4: 0x10065a21c - core::fmt::write::h40b2bc7dd3851337 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/fmt/mod.rs:1198:17 5: 0x1006088c0 - std::io::Write::write_fmt::hd8ce10e2be917d3e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/io/mod.rs:1672:15 6: 0x10061852c - std::sys_common::backtrace::_print::hb50c5f98c12dd1cb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:48:5 7: 0x10061852c - std::sys_common::backtrace::print::he2182b4a2ed0c13b at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:35:9 8: 0x10061852c - std::panicking::default_hook::{{closure}}::h09f2eab8666e3c6e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:295:22 9: 0x100618250 - std::panicking::default_hook::h7d3a44c15ae9a1cf at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:314:9 10: 0x100618b64 - std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:698:17 11: 0x100618a60 - std::panicking::begin_panic_handler::{{closure}}::h9aabdb3a8b938975 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:586:13 12: 0x100615f34 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:138:18 13: 0x1006187f0 - rust_begin_unwind at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:584:5 14: 0x1028f0468 - core::panicking::panic_fmt::h933972a421d72558 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:142:14 15: 0x1028f0388 - core::panicking::panic::h02442e675d4079e6 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:48:5 16: 0x100cc7408 - wasmtime_runtime::traphandlers::raise_trap::{{closure}}::heabf4d6e766b2e45 17: 0x100cc771c - wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 18: 0x100cd6d88 - wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 19: 0x100cd6da4 - wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba 20: 0x1006b8d24 - <F as wasmtime::func::IntoFunc<T,(wasmtime::func::Caller<T>,),R>>::into_func::wasm_to_host_shim::h02b614e7c13b5d6c 21: 0x10ac36fb8 - <unknown> fatal runtime error: failed to initiate panic, error 3 Process 99864 stopped
The wrapper project is in
https://github.com/bxq2011hust/bcos-wasm/blob/d0813e5e5156148acdca55ba286603802a5d01b6/src/lib.rs#L379-L648
bxq2011hust reopened issue #3571:
Thanks for filing a bug report! Please fill out the TODOs below.
Note: if you want to report a security issue, please read our security policy!
Test Case
upload Wasm file here
Steps to Reproduce
first, call a wasm function
second, in the called wasm function, call host function, host function call a function in another wasm instance, then calll a host function which return a trap to interrupt the execution and return result to first wasm call.
third, the second wasm call maybe in the same thread as the first wasm call, because we use boost coroutineExpected Results
What do you expect to happen?
just return the trap with user defined message
Actual Results
thread '<unnamed>' panicked at 'called
Option::unwrap()on a
Nonevalue', crates/runtime/src/traphandlers.rs:84:27
and wasmtime return a trap with
called
Option::unwrap()on a
Nonevalue
Versions and Environment
Wasmtime version or commit: v0.31.0
Operating system: Ubuntu 20.04
Architecture: x86_64
Extra Info
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates/runtime/src/traphandlers.rs:84:27 stack backtrace: 0: 0x55f8b0151850 - std::backtrace_rs::backtrace::libunwind::trace::hfa838fc631229987 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x55f8b0151850 - std::backtrace_rs::backtrace::trace_unsynchronized::h93a23e36ec026219 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55f8b0151850 - std::sys_common::backtrace::_print_fmt::hba56c7f796a4152f at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55f8b0151850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h214637f1e26310e1 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55f8b01be22c - core::fmt::write::h7aa6cd0067dca82a at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/fmt/mod.rs:1110:17 5: 0x55f8b01431e5 - std::io::Write::write_fmt::heb07fc0616bbd06d at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/io/mod.rs:1588:15 6: 0x55f8b01556db - std::sys_common::backtrace::_print::h2c2441c37e894fb5 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55f8b01556db - std::sys_common::backtrace::print::h4fb679ac439362ea at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55f8b01556db - std::panicking::default_hook::{{closure}}::h56bbadec2356e5d2 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:208:50 9: 0x55f8b01551b1 - std::panicking::default_hook::hb25822b45f6fdc4e at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:225:9 10: 0x55f8b0155f04 - std::panicking::rust_panic_with_hook::h4da5578e7277d2d4 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:622:17 11: 0x55f8b01559a7 - std::panicking::begin_panic_handler::{{closure}}::h003783ddb3cba4e8 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:517:13 12: 0x55f8b0151d2c - std::sys_common::backtrace::__rust_end_short_backtrace::hd138d2032731ed21 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55f8b0155939 - rust_begin_unwind at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:515:5 14: 0x55f8af240cd1 - core::panicking::panic_fmt::hbe99dddd3092ba3c at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:92:14 15: 0x55f8af240c1d - core::panicking::panic::h3de4db67bd397eb3 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:50:5 16: 0x55f8b07c98d7 - wasmtime_runtime::traphandlers::raise_user_trap::{{closure}}::h379a9d8be1f58dd1 17: 0x55f8b07c9bec - wasmtime_runtime::traphandlers::tls::with::he8d24e4beebeef49 18: 0x55f8b07c7f96 - wasmtime_runtime::traphandlers::raise_user_trap::h551a36e7a2d8cd18 19: 0x55f8b0281638 - wasmtime::trampoline::func::stub_fn::hb6d8bd05900c5561 20: 0x7fd2140a8033 - <unknown> 21: 0x7fd2140f1ddd - <unknown> 22: 0x7fd2140e6938 - <unknown> 23: 0x7fd2140eed0a - <unknown> 24: 0x7fd2140e26b3 - <unknown> 25: 0x7fd2140ee293 - <unknown> 26: 0x7fd2140a2006 - <unknown> 27: 0x55f8b07de82c - wasmtime_setjmp 28: 0x55f8b027aef6 - wasmtime_runtime::traphandlers::catch_traps::hf8385270d50bd059 29: 0x55f8b08c93bb - wasmtime::func::Func::call::hfad085cecac9e549 30: 0x55f8b0322551 - wasm_func_call 31: 0x55f8b0269fd1 - _ZN4hera11WasmcEngine7executeERN4evmc11HostContextESt17basic_string_viewIhSt11char_traitsIhEES7_RK12evmc_messageb
Maybe call two wasm instance use one thread is not permitted? or there is a problem use trap to interrupt execution?
bxq2011hust edited a comment on issue #3571:
hello, I use the rust wrapper wasmtime's async interface
instantiate_async
andcall_async
, also called by boost coroutines, but still got the same error when host function returns a Trap. Any suggestions?Process 99864 resuming thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/baixingqiang/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.40.1/src/traphandlers.rs:84:22 stack backtrace: 0: 0x100615a28 - std::backtrace_rs::backtrace::libunwind::trace::h131b1d2b50b7c0eb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 1: 0x100615a28 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ef9f6d47e4a5c40 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x100615a28 - std::sys_common::backtrace::_print_fmt::hae9bffa833e2d615 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:66:5 3: 0x100615a28 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h53309d90f6cc2c13 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:45:22 4: 0x10065a21c - core::fmt::write::h40b2bc7dd3851337 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/fmt/mod.rs:1198:17 5: 0x1006088c0 - std::io::Write::write_fmt::hd8ce10e2be917d3e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/io/mod.rs:1672:15 6: 0x10061852c - std::sys_common::backtrace::_print::hb50c5f98c12dd1cb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:48:5 7: 0x10061852c - std::sys_common::backtrace::print::he2182b4a2ed0c13b at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:35:9 8: 0x10061852c - std::panicking::default_hook::{{closure}}::h09f2eab8666e3c6e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:295:22 9: 0x100618250 - std::panicking::default_hook::h7d3a44c15ae9a1cf at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:314:9 10: 0x100618b64 - std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:698:17 11: 0x100618a60 - std::panicking::begin_panic_handler::{{closure}}::h9aabdb3a8b938975 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:586:13 12: 0x100615f34 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:138:18 13: 0x1006187f0 - rust_begin_unwind at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:584:5 14: 0x1028f0468 - core::panicking::panic_fmt::h933972a421d72558 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:142:14 15: 0x1028f0388 - core::panicking::panic::h02442e675d4079e6 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:48:5 16: 0x100cc7408 - wasmtime_runtime::traphandlers::raise_trap::{{closure}}::heabf4d6e766b2e45 17: 0x100cc771c - wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 18: 0x100cd6d88 - wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 19: 0x100cd6da4 - wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba 20: 0x1006b8d24 - <F as wasmtime::func::IntoFunc<T,(wasmtime::func::Caller<T>,),R>>::into_func::wasm_to_host_shim::h02b614e7c13b5d6c 21: 0x10ac36fb8 - <unknown> fatal runtime error: failed to initiate panic, error 3 Process 99864 stopped
The wrapper project is in
bxq2011hust edited a comment on issue #3571:
hello, I use the rust wrapper wasmtime's async interface
instantiate_async
andcall_async
, also called by boost coroutines, but still got the same error when host function returns a Trap. Any suggestions? @alexcrichton @bjorn3Process 99864 resuming thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/baixingqiang/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.40.1/src/traphandlers.rs:84:22 stack backtrace: 0: 0x100615a28 - std::backtrace_rs::backtrace::libunwind::trace::h131b1d2b50b7c0eb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 1: 0x100615a28 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ef9f6d47e4a5c40 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x100615a28 - std::sys_common::backtrace::_print_fmt::hae9bffa833e2d615 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:66:5 3: 0x100615a28 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h53309d90f6cc2c13 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:45:22 4: 0x10065a21c - core::fmt::write::h40b2bc7dd3851337 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/fmt/mod.rs:1198:17 5: 0x1006088c0 - std::io::Write::write_fmt::hd8ce10e2be917d3e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/io/mod.rs:1672:15 6: 0x10061852c - std::sys_common::backtrace::_print::hb50c5f98c12dd1cb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:48:5 7: 0x10061852c - std::sys_common::backtrace::print::he2182b4a2ed0c13b at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:35:9 8: 0x10061852c - std::panicking::default_hook::{{closure}}::h09f2eab8666e3c6e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:295:22 9: 0x100618250 - std::panicking::default_hook::h7d3a44c15ae9a1cf at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:314:9 10: 0x100618b64 - std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:698:17 11: 0x100618a60 - std::panicking::begin_panic_handler::{{closure}}::h9aabdb3a8b938975 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:586:13 12: 0x100615f34 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:138:18 13: 0x1006187f0 - rust_begin_unwind at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:584:5 14: 0x1028f0468 - core::panicking::panic_fmt::h933972a421d72558 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:142:14 15: 0x1028f0388 - core::panicking::panic::h02442e675d4079e6 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:48:5 16: 0x100cc7408 - wasmtime_runtime::traphandlers::raise_trap::{{closure}}::heabf4d6e766b2e45 17: 0x100cc771c - wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 18: 0x100cd6d88 - wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 19: 0x100cd6da4 - wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba 20: 0x1006b8d24 - <F as wasmtime::func::IntoFunc<T,(wasmtime::func::Caller<T>,),R>>::into_func::wasm_to_host_shim::h02b614e7c13b5d6c 21: 0x10ac36fb8 - <unknown> fatal runtime error: failed to initiate panic, error 3 Process 99864 stopped
The wrapper project is in
bxq2011hust edited a comment on issue #3571:
hello, I use rust wrap the wasmtime's async interface
instantiate_async
andcall_async
, also called by boost coroutines, but still got the same error when host function returns a Trap. Any suggestions? @alexcrichton @bjorn3Process 99864 resuming thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/baixingqiang/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.40.1/src/traphandlers.rs:84:22 stack backtrace: 0: 0x100615a28 - std::backtrace_rs::backtrace::libunwind::trace::h131b1d2b50b7c0eb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 1: 0x100615a28 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ef9f6d47e4a5c40 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x100615a28 - std::sys_common::backtrace::_print_fmt::hae9bffa833e2d615 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:66:5 3: 0x100615a28 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h53309d90f6cc2c13 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:45:22 4: 0x10065a21c - core::fmt::write::h40b2bc7dd3851337 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/fmt/mod.rs:1198:17 5: 0x1006088c0 - std::io::Write::write_fmt::hd8ce10e2be917d3e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/io/mod.rs:1672:15 6: 0x10061852c - std::sys_common::backtrace::_print::hb50c5f98c12dd1cb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:48:5 7: 0x10061852c - std::sys_common::backtrace::print::he2182b4a2ed0c13b at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:35:9 8: 0x10061852c - std::panicking::default_hook::{{closure}}::h09f2eab8666e3c6e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:295:22 9: 0x100618250 - std::panicking::default_hook::h7d3a44c15ae9a1cf at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:314:9 10: 0x100618b64 - std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:698:17 11: 0x100618a60 - std::panicking::begin_panic_handler::{{closure}}::h9aabdb3a8b938975 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:586:13 12: 0x100615f34 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:138:18 13: 0x1006187f0 - rust_begin_unwind at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:584:5 14: 0x1028f0468 - core::panicking::panic_fmt::h933972a421d72558 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:142:14 15: 0x1028f0388 - core::panicking::panic::h02442e675d4079e6 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:48:5 16: 0x100cc7408 - wasmtime_runtime::traphandlers::raise_trap::{{closure}}::heabf4d6e766b2e45 17: 0x100cc771c - wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 18: 0x100cd6d88 - wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 19: 0x100cd6da4 - wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba 20: 0x1006b8d24 - <F as wasmtime::func::IntoFunc<T,(wasmtime::func::Caller<T>,),R>>::into_func::wasm_to_host_shim::h02b614e7c13b5d6c 21: 0x10ac36fb8 - <unknown> fatal runtime error: failed to initiate panic, error 3 Process 99864 stopped
The wrapper project is in
bxq2011hust edited a comment on issue #3571:
hello, I use rust wrap the wasmtime's async interface
instantiate_async
andcall_async
, also called by boost coroutines, but still got the same error when host function returns a Trap. Any suggestions? @alexcrichton @bjorn3Process 99864 resuming thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/baixingqiang/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.40.1/src/traphandlers.rs:84:22 stack backtrace: 0: 0x100615a28 - std::backtrace_rs::backtrace::libunwind::trace::h131b1d2b50b7c0eb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 1: 0x100615a28 - std::backtrace_rs::backtrace::trace_unsynchronized::h9ef9f6d47e4a5c40 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x100615a28 - std::sys_common::backtrace::_print_fmt::hae9bffa833e2d615 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:66:5 3: 0x100615a28 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h53309d90f6cc2c13 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:45:22 4: 0x10065a21c - core::fmt::write::h40b2bc7dd3851337 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/fmt/mod.rs:1198:17 5: 0x1006088c0 - std::io::Write::write_fmt::hd8ce10e2be917d3e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/io/mod.rs:1672:15 6: 0x10061852c - std::sys_common::backtrace::_print::hb50c5f98c12dd1cb at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:48:5 7: 0x10061852c - std::sys_common::backtrace::print::he2182b4a2ed0c13b at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:35:9 8: 0x10061852c - std::panicking::default_hook::{{closure}}::h09f2eab8666e3c6e at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:295:22 9: 0x100618250 - std::panicking::default_hook::h7d3a44c15ae9a1cf at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:314:9 10: 0x100618b64 - std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:698:17 11: 0x100618a60 - std::panicking::begin_panic_handler::{{closure}}::h9aabdb3a8b938975 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:586:13 12: 0x100615f34 - std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/sys_common/backtrace.rs:138:18 13: 0x1006187f0 - rust_begin_unwind at /rustc/2643b16468fda787470340890212591d8bc832b7/library/std/src/panicking.rs:584:5 14: 0x1028f0468 - core::panicking::panic_fmt::h933972a421d72558 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:142:14 15: 0x1028f0388 - core::panicking::panic::h02442e675d4079e6 at /rustc/2643b16468fda787470340890212591d8bc832b7/library/core/src/panicking.rs:48:5 16: 0x100cc7408 - wasmtime_runtime::traphandlers::raise_trap::{{closure}}::heabf4d6e766b2e45 17: 0x100cc771c - wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 18: 0x100cd6d88 - wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 19: 0x100cd6da4 - wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba 20: 0x1006b8d24 - <F as wasmtime::func::IntoFunc<T,(wasmtime::func::Caller<T>,),R>>::into_func::wasm_to_host_shim::h02b614e7c13b5d6c 21: 0x10ac36fb8 - <unknown> fatal runtime error: failed to initiate panic, error 3 Process 99864 stopped
* thread #194, stop reason = signal SIGABRT frame #0: 0x0000000195f96d98 libsystem_kernel.dylib`__pthread_kill + 8 libsystem_kernel.dylib`__pthread_kill: -> 0x195f96d98 <+8>: b.lo 0x195f96db8 ; <+40> 0x195f96d9c <+12>: pacibsp 0x195f96da0 <+16>: stp x29, x30, [sp, #-0x10]! 0x195f96da4 <+20>: mov x29, sp Target 0: (fisco-bcos) stopped. (lldb) bt * thread #194, stop reason = signal SIGABRT * frame #0: 0x0000000195f96d98 libsystem_kernel.dylib`__pthread_kill + 8 frame #1: 0x0000000195fcbee0 libsystem_pthread.dylib`pthread_kill + 288 frame #2: 0x0000000195f06340 libsystem_c.dylib`abort + 168 frame #3: 0x00000001006214c8 fisco-bcos`std::sys::unix::abort_internal::h8751881e49172a67 at mod.rs:293:14 [opt] frame #4: 0x0000000100618e60 fisco-bcos`rust_panic at panicking.rs:748:5 [opt] frame #5: 0x0000000100618c1c fisco-bcos`std::panicking::rust_panic_with_hook::h53cf0f5de8678eab at panicking.rs:716:5 [opt] frame #6: 0x0000000100618a60 fisco-bcos`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h9aabdb3a8b938975 at panicking.rs:586:13 [opt] frame #7: 0x0000000100615f34 fisco-bcos`std::sys_common::backtrace::__rust_end_short_backtrace::h7e2931504cf15b78 at backtrace.rs:138:18 [opt] frame #8: 0x00000001006187f0 fisco-bcos`rust_begin_unwind at panicking.rs:584:5 [opt] frame #9: 0x00000001028f0468 fisco-bcos`core::panicking::panic_fmt::h933972a421d72558 at panicking.rs:142:14 [opt] frame #10: 0x00000001028f0388 fisco-bcos`core::panicking::panic::h02442e675d4079e6 at panicking.rs:48:5 [opt] frame #11: 0x0000000100cc7408 fisco-bcos`wasmtime_runtime::traphandlers::raise_trap::_$u7b$$u7b$closure$u7d$$u7d$::heabf4d6e766b2e45 + 48 frame #12: 0x0000000100cc771c fisco-bcos`wasmtime_runtime::traphandlers::tls::with::h06d21890d7c20a37 + 44 frame #13: 0x0000000100cd6d88 fisco-bcos`wasmtime_runtime::traphandlers::raise_trap::h895067d64d3f4f72 + 28 frame #14: 0x0000000100cd6da4 fisco-bcos`wasmtime_runtime::traphandlers::raise_user_trap::h85cbe8cba4567dba + 28 frame #15: 0x00000001006b8d24 fisco-bcos`_$LT$F$u20$as$u20$wasmtime..func..IntoFunc$LT$T$C$$LP$wasmtime..func..Caller$LT$T$GT$$C$$RP$$C$R$GT$$GT$::into_func::wasm_to_host_shim::h02b614e7c13b5d6c + 200 frame #16: 0x000000010ac36fb8 frame #17: 0x000000010ac24ae4 frame #18: 0x000000010ac25190 frame #19: 0x000000010ac109c8 frame #20: 0x000000010ac1ccb8 frame #21: 0x000000010ac05e4c frame #22: 0x000000010ac0e73c frame #23: 0x000000010ac0a1bc frame #24: 0x000000010ac0e2a8 frame #25: 0x0000000100697ca4 fisco-bcos`wasmtime_runtime::traphandlers::catch_traps::call_closure::h0b42f9214e97f261 + 56 frame #26: 0x0000000100ce2f7c fisco-bcos`wasmtime_setjmp + 100 frame #27: 0x00000001006c3978 fisco-bcos`wasmtime_runtime::traphandlers::_$LT$impl$u20$wasmtime_runtime..traphandlers..call_thread_state..CallThreadState$GT$::with::hdb0d5a000b4f1065 + 80 frame #28: 0x0000000100697da8 fisco-bcos`wasmtime_runtime::traphandlers::catch_traps::h2ccbf2e4c0be9210 + 92 frame #29: 0x00000001006ba290 fisco-bcos`wasmtime::func::invoke_wasm_and_catch_traps::h4ef3e159fa04bdc9 + 204 frame #30: 0x00000001006c515c fisco-bcos`_$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::h2e521dd943b096f2 + 212 frame #31: 0x000000010069cea4 fisco-bcos`wasmtime_fiber::unix::fiber_start::h3af38fcf9bd94bf1 + 76 frame #32: 0x0000000100ce325c fisco-bcos`wasmtime_fiber_start + 12 frame #33: 0x0000000100772ef0 fisco-bcos`wasmtime_fiber::Fiber$LT$Resume$C$Yield$C$Return$GT$::resume::he6bf02490fa51ec1 + 68 frame #34: 0x00000001007a8e98 fisco-bcos`_$LT$wasmtime..store..$LT$impl$u20$wasmtime..store..context..StoreContextMut$LT$T$GT$$GT$..on_fiber..$u7b$$u7b$closure$u7d$$u7d$..FiberFuture$u20$as$u20$core..future..future..Future$GT$::poll::h77c36198dd2a3df3 + 40 frame #35: 0x00000001006a06fc fisco-bcos`_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::ha175e17d428274ec + 412 frame #36: 0x00000001006aaf70 fisco-bcos`std::thread::local::LocalKey$LT$T$GT$::with::h02c9f49018aa9f14 + 88 frame #37: 0x00000001006a0b28 fisco-bcos`_$LT$core..future..from_generator..GenFuture$LT$T$GT$$u20$as$u20$core..future..future..Future$GT$::poll::hcac783e9c673b7cf + 476 frame #38: 0x00000001006a7828 fisco-bcos`async_io::driver::block_on::h60ffcea78eed64fa + 336 frame #39: 0x00000001006b5098 fisco-bcos`async_global_executor::executor::block_on::h26c24b6e3f486f9b + 200 frame #40: 0x00000001006abddc fisco-bcos`std::thread::local::LocalKey$LT$T$GT$::with::hb248c29ad05b3c99 + 228 frame #41: 0x00000001006b0904 fisco-bcos`async_std::task::builder::Builder::blocking::h8b76b48f833c2dae + 744 frame #42: 0x00000001006922f0 fisco-bcos`_$LT$bcos_wasm..BcosWasm$u20$as$u20$evmc_vm..EvmcVm$GT$::execute::h4262a19fd4d3c41b + 5876 frame #43: 0x00000001006c4558 fisco-bcos`std::panicking::try::h9775df534a3e806f + 316 frame #44: 0x0000000100692cfc fisco-bcos`bcos_wasm::__evmc_execute::ha83c4d76d2fe28b0 + 220 frame #45: 0x000000010050e34c fisco-bcos`bcos::executor::VMInstance::exec(this=<unavaila [message truncated]
alexcrichton commented on issue #3571:
@bxq2011hust if you're using boost coroutines then this is the same issue as before I believe. Wasmtime has a TLS variable which must be saved/restored across coroutine switches which I suspect that boost does not have support for. Wasmtime, at this time, does not support being called from an external coroutine library.
bxq2011hust commented on issue #3571:
@bxq2011hust if you're using boost coroutines then this is the same issue as before I believe. Wasmtime has a TLS variable which must be saved/restored across coroutine switches which I suspect that boost does not have support for. Wasmtime, at this time, does not support being called from an external coroutine library.
ok, got it, thanks
bxq2011hust closed issue #3571:
Thanks for filing a bug report! Please fill out the TODOs below.
Note: if you want to report a security issue, please read our security policy!
Test Case
upload Wasm file here
Steps to Reproduce
first, call a wasm function
second, in the called wasm function, call host function, host function call a function in another wasm instance, then calll a host function which return a trap to interrupt the execution and return result to first wasm call.
third, the second wasm call maybe in the same thread as the first wasm call, because we use boost coroutineExpected Results
What do you expect to happen?
just return the trap with user defined message
Actual Results
thread '<unnamed>' panicked at 'called
Option::unwrap()on a
Nonevalue', crates/runtime/src/traphandlers.rs:84:27
and wasmtime return a trap with
called
Option::unwrap()on a
Nonevalue
Versions and Environment
Wasmtime version or commit: v0.31.0
Operating system: Ubuntu 20.04
Architecture: x86_64
Extra Info
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates/runtime/src/traphandlers.rs:84:27 stack backtrace: 0: 0x55f8b0151850 - std::backtrace_rs::backtrace::libunwind::trace::hfa838fc631229987 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x55f8b0151850 - std::backtrace_rs::backtrace::trace_unsynchronized::h93a23e36ec026219 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55f8b0151850 - std::sys_common::backtrace::_print_fmt::hba56c7f796a4152f at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55f8b0151850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h214637f1e26310e1 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55f8b01be22c - core::fmt::write::h7aa6cd0067dca82a at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/fmt/mod.rs:1110:17 5: 0x55f8b01431e5 - std::io::Write::write_fmt::heb07fc0616bbd06d at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/io/mod.rs:1588:15 6: 0x55f8b01556db - std::sys_common::backtrace::_print::h2c2441c37e894fb5 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55f8b01556db - std::sys_common::backtrace::print::h4fb679ac439362ea at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55f8b01556db - std::panicking::default_hook::{{closure}}::h56bbadec2356e5d2 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:208:50 9: 0x55f8b01551b1 - std::panicking::default_hook::hb25822b45f6fdc4e at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:225:9 10: 0x55f8b0155f04 - std::panicking::rust_panic_with_hook::h4da5578e7277d2d4 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:622:17 11: 0x55f8b01559a7 - std::panicking::begin_panic_handler::{{closure}}::h003783ddb3cba4e8 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:517:13 12: 0x55f8b0151d2c - std::sys_common::backtrace::__rust_end_short_backtrace::hd138d2032731ed21 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55f8b0155939 - rust_begin_unwind at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/std/src/panicking.rs:515:5 14: 0x55f8af240cd1 - core::panicking::panic_fmt::hbe99dddd3092ba3c at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:92:14 15: 0x55f8af240c1d - core::panicking::panic::h3de4db67bd397eb3 at /rustc/a85f584aebd9b08314bf30b9adc17b4a752143e5/library/core/src/panicking.rs:50:5 16: 0x55f8b07c98d7 - wasmtime_runtime::traphandlers::raise_user_trap::{{closure}}::h379a9d8be1f58dd1 17: 0x55f8b07c9bec - wasmtime_runtime::traphandlers::tls::with::he8d24e4beebeef49 18: 0x55f8b07c7f96 - wasmtime_runtime::traphandlers::raise_user_trap::h551a36e7a2d8cd18 19: 0x55f8b0281638 - wasmtime::trampoline::func::stub_fn::hb6d8bd05900c5561 20: 0x7fd2140a8033 - <unknown> 21: 0x7fd2140f1ddd - <unknown> 22: 0x7fd2140e6938 - <unknown> 23: 0x7fd2140eed0a - <unknown> 24: 0x7fd2140e26b3 - <unknown> 25: 0x7fd2140ee293 - <unknown> 26: 0x7fd2140a2006 - <unknown> 27: 0x55f8b07de82c - wasmtime_setjmp 28: 0x55f8b027aef6 - wasmtime_runtime::traphandlers::catch_traps::hf8385270d50bd059 29: 0x55f8b08c93bb - wasmtime::func::Func::call::hfad085cecac9e549 30: 0x55f8b0322551 - wasm_func_call 31: 0x55f8b0269fd1 - _ZN4hera11WasmcEngine7executeERN4evmc11HostContextESt17basic_string_viewIhSt11char_traitsIhEES7_RK12evmc_messageb
Maybe call two wasm instance use one thread is not permitted? or there is a problem use trap to interrupt execution?
Last updated: Dec 23 2024 at 12:05 UTC