Stream: git-wasmtime

Topic: wasmtime / issue #7310 Multithread application traps with...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 08:17):

dbaeumer added the bug label to Issue #7310.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 08:18):

dbaeumer opened issue #7310:

Error: error while executing at wasm backtrace:
    0: 0x1eda65 - <unknown>!core::sync::atomic::atomic_compare_exchange::he4db91b5677645c3
    1: 0x1a2511 - <unknown>!core::sync::atomic::AtomicUsize::compare_exchange::h10d76addb394aeb4
    2: 0x191b87 - <unknown>!crossbeam_channel::context::Context::try_select::hedc42d580d0f5209
    3: 0x1c08f6 - <unknown>!crossbeam_channel::waker::Waker::try_select::{{closure}}::h861e99c8443efe4d
    4: 0x188745 - <unknown>!<core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::position::hd056e06b364e3e44
    5: 0x1c0784 - <unknown>!crossbeam_channel::waker::Waker::try_select::h8c5edd4b2c5fd9da
    6: 0x18a9a8 - <unknown>!crossbeam_channel::flavors::zero::Channel<T>::send::h8a671c75a1062370
    7: 0x1e0917 - <unknown>!crossbeam_channel::channel::Sender<T>::send::hd7006c022325632f
    8: 0x1c972c - <unknown>!lsp_server::stdio::stdio_transport::{{closure}}::h95daef3273f8dae0
    9: 0x195d98 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hae1a61c1cb243dba
   10: 0x17d215 - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h8f84e616a49c3966
   11: 0x188a17 - <unknown>!<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h8419b25b3e5d3010
   12: 0x1ae909 - <unknown>!std::panicking::try::do_call::hc2efa2fef97ee73a
   13: 0x1ae7e9 - <unknown>!std::panicking::try::hb437d11b30ef124c
   14: 0x17cd7a - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::h48ecccc2f2bc6ed7
   15: 0x1b5bf2 - <unknown>!core::ops::function::FnOnce::call_once{{vtable.shim}}::hea4d8be1b607e767
   16: 0x2a310b - <unknown>!std::sys::wasi::thread::Thread::new::thread_start::h59449041806aed76
   17: 0x2a7673 - <unknown>!__wasi_thread_start_C
   18: 0x2a81ee - <unknown>!wasi_thread_start
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: unaligned atomic

Steps to Reproduce

Expected Results

wasm lsp server handles messages correctly

Actual Results

You get the above stack trace

Versions and Environment

Wasmtime: wasmtime-cli 13.0.0
Rustc: rustc 1.75.0-nightly (4578435e1 2023-10-19)

Operating system: Ubuntu 20.04

Architecture: x64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 08:20):

dbaeumer edited issue #7310:

Error: error while executing at wasm backtrace:
    0: 0x1eda65 - <unknown>!core::sync::atomic::atomic_compare_exchange::he4db91b5677645c3
    1: 0x1a2511 - <unknown>!core::sync::atomic::AtomicUsize::compare_exchange::h10d76addb394aeb4
    2: 0x191b87 - <unknown>!crossbeam_channel::context::Context::try_select::hedc42d580d0f5209
    3: 0x1c08f6 - <unknown>!crossbeam_channel::waker::Waker::try_select::{{closure}}::h861e99c8443efe4d
    4: 0x188745 - <unknown>!<core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::position::hd056e06b364e3e44
    5: 0x1c0784 - <unknown>!crossbeam_channel::waker::Waker::try_select::h8c5edd4b2c5fd9da
    6: 0x18a9a8 - <unknown>!crossbeam_channel::flavors::zero::Channel<T>::send::h8a671c75a1062370
    7: 0x1e0917 - <unknown>!crossbeam_channel::channel::Sender<T>::send::hd7006c022325632f
    8: 0x1c972c - <unknown>!lsp_server::stdio::stdio_transport::{{closure}}::h95daef3273f8dae0
    9: 0x195d98 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hae1a61c1cb243dba
   10: 0x17d215 - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h8f84e616a49c3966
   11: 0x188a17 - <unknown>!<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h8419b25b3e5d3010
   12: 0x1ae909 - <unknown>!std::panicking::try::do_call::hc2efa2fef97ee73a
   13: 0x1ae7e9 - <unknown>!std::panicking::try::hb437d11b30ef124c
   14: 0x17cd7a - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::h48ecccc2f2bc6ed7
   15: 0x1b5bf2 - <unknown>!core::ops::function::FnOnce::call_once{{vtable.shim}}::hea4d8be1b607e767
   16: 0x2a310b - <unknown>!std::sys::wasi::thread::Thread::new::thread_start::h59449041806aed76
   17: 0x2a7673 - <unknown>!__wasi_thread_start_C
   18: 0x2a81ee - <unknown>!wasi_thread_start
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: unaligned atomic

Steps to Reproduce

Expected Results

wasm lsp server handles messages correctly

Actual Results

You get the above stack trace

Versions and Environment

Wasmtime: wasmtime-cli 13.0.0
Rustc: rustc 1.75.0-nightly (4578435e1 2023-10-19) & rustc 1.73.0

Operating system: Ubuntu 20.04

Architecture: x64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 15:34):

alexcrichton commented on issue #7310:

Thanks for the report! I believe that Wasmtime is working correctly here because with some local debugging I found that the atomic is indeed not aligned correctly.

Further debugging showed that when built in release mode the server works well. My guess is that you're running into a stack overflow here which would become a segfault in native code but is not caught in WebAssembly code. Release mode typically takes less stack space which is probably why it works in release mode and not in debug mode.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 15:34):

alexcrichton closed issue #7310:

Error: error while executing at wasm backtrace:
    0: 0x1eda65 - <unknown>!core::sync::atomic::atomic_compare_exchange::he4db91b5677645c3
    1: 0x1a2511 - <unknown>!core::sync::atomic::AtomicUsize::compare_exchange::h10d76addb394aeb4
    2: 0x191b87 - <unknown>!crossbeam_channel::context::Context::try_select::hedc42d580d0f5209
    3: 0x1c08f6 - <unknown>!crossbeam_channel::waker::Waker::try_select::{{closure}}::h861e99c8443efe4d
    4: 0x188745 - <unknown>!<core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::position::hd056e06b364e3e44
    5: 0x1c0784 - <unknown>!crossbeam_channel::waker::Waker::try_select::h8c5edd4b2c5fd9da
    6: 0x18a9a8 - <unknown>!crossbeam_channel::flavors::zero::Channel<T>::send::h8a671c75a1062370
    7: 0x1e0917 - <unknown>!crossbeam_channel::channel::Sender<T>::send::hd7006c022325632f
    8: 0x1c972c - <unknown>!lsp_server::stdio::stdio_transport::{{closure}}::h95daef3273f8dae0
    9: 0x195d98 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::hae1a61c1cb243dba
   10: 0x17d215 - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h8f84e616a49c3966
   11: 0x188a17 - <unknown>!<core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h8419b25b3e5d3010
   12: 0x1ae909 - <unknown>!std::panicking::try::do_call::hc2efa2fef97ee73a
   13: 0x1ae7e9 - <unknown>!std::panicking::try::hb437d11b30ef124c
   14: 0x17cd7a - <unknown>!std::thread::Builder::spawn_unchecked_::{{closure}}::h48ecccc2f2bc6ed7
   15: 0x1b5bf2 - <unknown>!core::ops::function::FnOnce::call_once{{vtable.shim}}::hea4d8be1b607e767
   16: 0x2a310b - <unknown>!std::sys::wasi::thread::Thread::new::thread_start::h59449041806aed76
   17: 0x2a7673 - <unknown>!__wasi_thread_start_C
   18: 0x2a81ee - <unknown>!wasi_thread_start
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: unaligned atomic

Steps to Reproduce

Expected Results

wasm lsp server handles messages correctly

Actual Results

You get the above stack trace

Versions and Environment

Wasmtime: wasmtime-cli 13.0.0
Rustc: rustc 1.75.0-nightly (4578435e1 2023-10-19) & rustc 1.73.0

Operating system: Ubuntu 20.04

Architecture: x64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2023 at 15:50):

dbaeumer commented on issue #7310:

@alexcrichton thanks for the pointer. Will use release mode instead.


Last updated: Nov 22 2024 at 17:03 UTC