Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] crashes : RuntimeError: Out of bounds memory access #7154

Closed
t0muxx opened this issue Jun 7, 2023 · 8 comments
Closed

[bug] crashes : RuntimeError: Out of bounds memory access #7154

t0muxx opened this issue Jun 7, 2023 · 8 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@t0muxx
Copy link

t0muxx commented Jun 7, 2023

Describe the bug

Hello,

Context : I am currently developing an app with Tauri as backend and Leptos as front-end, and during development I had multiple crashes during application execution. Theses crashes happens sometimes directly at application start (by starting the app either with cargo tauri dev or using AppImage) or sometimes when doing a Reload.

The thing is, the crashes seems to happens with any Tauri with Rust template created with cargo create-tauri-app.
Here some example with a template app created using cargo create-tauri-app :

bug_1
(This time I had to Reload three times to trigger the crash, but sometimes it happens at first start)

Here is another example when using the AppImage generated by Tauri :
bug_2
(You can see the second time the application crashes directly)

Reproduction

  1. Create a Tauri app using cargo create-tauri-app
  2. Select Rust as front-end language
  3. Select Leptos as UI template.
  4. Now you can cd into the project directory
  5. Run the app using cargo tauri dev
  6. Open developer console to check for crashes
  7. Right-Click Reload until you get the crashes

You can also use this AppImage : https://file.io/qV7is0fTatqw

Note :

  • I get the bug with all other UI Template (Vanilla, Yew, Leptos or Sycamore)
  • The bug happens on Ubuntu too

Expected behavior

The application should not crash semi-randomly

Platform and versions

[✔] Environment
    - OS: Fedora 37.0.0 X64
    ✔ webkit2gtk-4.0: 2.40.2
    ✔ rsvg2: 2.54.5
    ✔ rustc: 1.67.0 (fc594f156 2023-01-24)
    ✔ Cargo: 1.67.0 (8ecd4f20a 2023-01-10)
    ✔ rustup: 1.25.2 (17db695f1 2023-02-01)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 18.16.0
    - yarn: 1.22.19
    - npm: 9.5.1

[-] Packages
    - tauri [RUST]: 1.3.0
    - tauri-build [RUST]: 1.3.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: not installed!
    - @tauri-apps/cli [NPM]: 1.3.1

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/

Stack trace

[Error] Unhandled Promise Rejection: RuntimeError: Out of bounds memory access (evaluating 'wasm.__wbindgen_start()')
	<?>.wasm-function[<core::cell::BorrowRefMut as core::ops::drop::Drop>::drop::hf42c085d7285d3bf] (test-ui-d856fd919585e10.js:612)
	<?>.wasm-function[core::ptr::drop_in_place<core::cell::BorrowRefMut>::h8315dbe9c700eb71]
	<?>.wasm-function[core::ptr::drop_in_place<core::cell::RefMut<leptos_dom::hydration::HydrationKey>>::h9149f27aa3a23070]
	<?>.wasm-function[leptos_dom::hydration::HydrationCtx::next_component::{{closure}}::h6883c5616db2da57]
	<?>.wasm-function[std::thread::local::LocalKey<T>::try_with::hb94a1e0a0aef6298]
	<?>.wasm-function[std::thread::local::LocalKey<T>::with::h89a5ada3f068daa0]
	<?>.wasm-function[leptos_dom::hydration::HydrationCtx::next_component::hc33f11bf247b26b6]
	<?>.wasm-function[leptos_dom::components::Component<F,V>::new::h465abdfae9683bc5]
	<?>.wasm-function[test_ui::app::App::hbad01cb3c50974fa]
	<?>.wasm-function[test_ui::main::{{closure}}::hde19ea94619b4cb6]
	<?>.wasm-function[leptos_dom::mount_to::{{closure}}::hd08507726cd06d49]
	<?>.wasm-function[leptos_reactive::runtime::RuntimeId::run_scope_undisposed::{{closure}}::h2390710064a783d0]
	<?>.wasm-function[leptos_reactive::runtime::with_runtime::{{closure}}::hfa3448a66d7673c7]
	<?>.wasm-function[std::thread::local::LocalKey<T>::try_with::hd4a7100a53c5c0c5]
	<?>.wasm-function[std::thread::local::LocalKey<T>::with::h30c6a5082ecc8b4b]
	<?>.wasm-function[leptos_reactive::runtime::with_runtime::h6a6a8e56b71ffd28]
	<?>.wasm-function[leptos_reactive::runtime::RuntimeId::run_scope_undisposed::h4069f30e99a0b11d]
	<?>.wasm-function[leptos_reactive::scope::create_scope::h5e625713b546d5da]
	<?>.wasm-function[leptos_dom::mount_to::hd2c03519c91041c3]
	<?>.wasm-function[leptos_dom::mount_to_body::h791b05ecb2e8fb8f]
	<?>.wasm-function[test_ui::main::h2310ebba16fb5874]
	<?>.wasm-function[core::ops::function::FnOnce::call_once::h684953229061ec4b]
	<?>.wasm-function[std::sys_common::backtrace::__rust_begin_short_backtrace::h68ebcd09cf1acae6]
	<?>.wasm-function[std::rt::lang_start::{{closure}}::h03c05521b45f41b4]
	<?>.wasm-function[std::rt::lang_start_internal::hbecc6ff7763fb2f1]
	<?>.wasm-function[std::rt::lang_start::h9cdb9a905687b1d8]
	<?>.wasm-function[main]
	<?>.wasm-function[]
	wasm-stub
	__wbg_finalize_init (test-ui-d856fd919585e10.js:612)

Additional context

I would happily help to fix this, but at this moment I don't know where to look to fix this.

Thanks

@t0muxx t0muxx added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 7, 2023
@amrbashir
Copy link
Member

this is either an issue in leptos wasm-js interaction implementation or in the webview itself, either way we can't do anything about it. I think it is something in leptos but I could be wrong, maybe try reaching out to leptos team.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
@t0muxx
Copy link
Author

t0muxx commented Jun 7, 2023

Hello,

Thanks for your reply, I'm sorry if it was not clear in the first issue message, but this crashes are not only related to leptos as they happens with every other UI template (Vanilla, Yew, Leptos or Sycamore).
Do you have any advice regarding where I can look to debug or fix this ? Is this related to WebkitGtk ?

Thanks

@amrbashir
Copy link
Member

Yew, leptos or sycamore are all using wasm-bindgen behind the scene so they all should have the same issue but are you sure 100% that vanilla is also suffering the same issue?

@t0muxx
Copy link
Author

t0muxx commented Jun 7, 2023

After verification, It's not happening on Vanilla. So this is related to wasm-bindgen right ?

Thanks for your time.

@amrbashir
Copy link
Member

yeah seems like it

@jrouaix
Copy link
Contributor

jrouaix commented Jul 27, 2023

Same here : https://github.com/jrouaix/wasm_pbm
filled something here : https://bugs.webkit.org/show_bug.cgi?id=259441
I think it'll slow the adoption of full stack rusty things if the community don't handle this specific problem of WASM on Webkit on Linux.

@maurerdietmar
Copy link

I also get various crashes running WASM on Webkit on Linux.

for example: rust-lang/hashbrown#194

Note: Everything work as expected with Chrome or Firefox.

Right now, it is quite impossible to use tauri on Linux because the WASM runtime is totally unstable...

@maurerdietmar
Copy link

Also uploaded a test application to reproduce the bug:

https://github.com/maurerdietmar/webkit-yew-bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

4 participants