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

wasm_bindgen-caused web crash when using more than 2GiB of RAM #1513

Closed
Wumpf opened this issue Mar 6, 2023 · 4 comments · Fixed by #1590 or #1605
Closed

wasm_bindgen-caused web crash when using more than 2GiB of RAM #1513

Wumpf opened this issue Mar 6, 2023 · 4 comments · Fixed by #1590 or #1605
Assignees
Labels
🪳 bug Something isn't working 💣 crash crash, deadlock/freeze, do-no-start 🕸️ web regarding running the viewer in a browser

Comments

@Wumpf
Copy link
Member

Wumpf commented Mar 6, 2023

We're getting fairly weird crashes when sending many log messages per frame.
image

Most reliable repro for this is running the nyud example on the web from a an rrd file. cargo run -p rerun --features web_viewer --release -- --web-viewer ../nyud.rrd

We spent already quite a bit of time investigating this, some findings so far:

  • what we log doesn't seem to matter. The crash typically shows a callstack pointing to DynamicResourcePool::alloc, but whether we log the desc there doesn't seem to matter
  • there is some suspicious looking log spam sometimes image
  • A bisection yielded CpuWriteGpuReadBelt for fast frame by frame memory transfers #1382, but CpuGpuReadBelt itself doesn't seem to be to blame, but the logs added there
    • andreas/safe-read-write-belt has an experiment with a slower but safe write belt and it didn't make a difference either

Link to internal Slack conversation

We should not log as much by default in the browser though! Once log mesages are limited to info, the crash disappears.

@Wumpf Wumpf added 🪳 bug Something isn't working 🕸️ web regarding running the viewer in a browser 💣 crash crash, deadlock/freeze, do-no-start labels Mar 6, 2023
@emilk emilk changed the title Rapid logging causes web viewer to crash Rapid text logging to console causes web viewer to crash Mar 8, 2023
@emilk
Copy link
Member

emilk commented Mar 11, 2023

We had this problem when we first switched to the wgpu renderer. Back then the solution was to lessen the wgpu log spam.

@emilk
Copy link
Member

emilk commented Mar 14, 2023

I think we should:

@jleibs
Copy link
Member

jleibs commented Mar 15, 2023

This crash still happening on Windows / Chrome.

re_viewer.js:250 wasm-bindgen: imported JS function that was not marked as `catch` threw an error: Failed to execute 'decode' on 'TextDecoder': The encoded data was not valid.

Stack:
TypeError: Failed to execute 'decode' on 'TextDecoder': The encoded data was not valid.
    at getStringFromWasm0 (http://127.0.0.1:9090/re_viewer.js:52:30)
    at http://127.0.0.1:9090/re_viewer.js:473:23
    at logError (http://127.0.0.1:9090/re_viewer.js:241:18)
    at imports.wbg.__wbg_debug_5724a17d71ee30be (http://127.0.0.1:9090/re_viewer.js:472:68)
    at <re_log::log_web::WebLogger as log::Log>::log::h7307dab4feba4ab0 (wasm://wasm/03926f7e:wasm-function[4494]:0x69a04b)
    at tracing::__macro_support::__tracing_log::h3fa7e5b1e5362b6e (wasm://wasm/03926f7e:wasm-function[9095]:0x88c9f1)
    at re_viewer::misc::caches::tensor_image_cache::ImageCache::purge_memory::h15409aaa79f7b3b5 (wasm://wasm/03926f7e:wasm-function[2333]:0x4f1d88)
    at <re_viewer::app::App as eframe::epi::App>::update::hb91cf160d1948745 (wasm://wasm/03926f7e:wasm-function[429]:0x3b098)
    at <re_viewer::remote_viewer_app::RemoteViewerApp as eframe::epi::App>::update::hd7e42035066700e2 (wasm://wasm/03926f7e:wasm-function[16884]:0x9b5fb7)
    at eframe::web::backend::AppRunner::logic::h50d1ef9f43177454 (wasm://wasm/03926f7e:wasm-function[1877]:0x46b10b)

@Wumpf Wumpf reopened this Mar 16, 2023
@Wumpf
Copy link
Member Author

Wumpf commented Mar 16, 2023

Not confirmed directly yet on this version, but it seems highly likely this was fixed in rustwasm/wasm-bindgen#3310

@emilk emilk changed the title Rapid text logging to console causes web viewer to crash wasm_bindgen-caused web crash when using more than 2GiB of RAM Mar 16, 2023
emilk added a commit that referenced this issue Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working 💣 crash crash, deadlock/freeze, do-no-start 🕸️ web regarding running the viewer in a browser
Projects
None yet
3 participants