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

Panic with error message on OOM in Wasm #648

Open
greenhat opened this issue Nov 8, 2022 · 0 comments
Open

Panic with error message on OOM in Wasm #648

greenhat opened this issue Nov 8, 2022 · 0 comments

Comments

@greenhat
Copy link
Member

greenhat commented Nov 8, 2022

Although wasm32 has a 4GB memory limit due to i32 use for pointer in wasm-bindgen glue code, the actual limit is 2GB - rustwasm/wasm-bindgen#2957, and the manifestation of hitting this limit is accessing a random memory. Like the following message:

TypeError [ERR_ENCODING_INVALID_ENCODED_DATA]: The encoded data was not valid for encoding utf-8
    at new NodeError (node:internal/errors:387:5)
    at TextDecoder.decode (node:internal/encoding:433:15)
    at getStringFromWasm0 (.../node_modules/ergo-lib-wasm-nodejs/ergo_lib_wasm.js:50:30)
    ...
  errno: 12,
  code: 'ERR_ENCODING_INVALID_ENCODED_DATA'
}
An error occurred while extracting data from transaction: TypeError [ERR_ENCODING_INVALID_ENCODED_DATA]: The encoded data was not valid for encoding utf-8

because a negative (i32) pointer is passed to functions like getStringFromWasm0 in the wasm-bindgen glue code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant