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

Throw error when WASM memory limit is reached #1969

Open
45930 opened this issue Jan 13, 2025 · 1 comment
Open

Throw error when WASM memory limit is reached #1969

45930 opened this issue Jan 13, 2025 · 1 comment

Comments

@45930
Copy link
Contributor

45930 commented Jan 13, 2025

Relates to: #1214 (memory leak + not handling OOM well is a recipe for disaster)

User reports node thread hangs after some number of iterations of recursive proving: https://discord.com/channels/484437221055922177/1326949912759500861

When WASM reaches it's memory limit, we should surface this in o1js. Current behavior is that the thread stays active, but cannot do any proving. Desired behavior is to throw an error letting the developer know they are out of WASM memory.

@onurinanc
Copy link

I have a similar issue after I upgraded the o1js-blobstream (https://github.com/Kirol54/o1js-blobstream-nori/tree/main): from o1js v1.5.0 to v2.2.0

valid zkp3?:  true
valid zkp0?:  true
valid zkp1?:  true
o1js-blobstream-nori/contracts/node_modules/o1js/dist/node/bindings/compiled/_node_bindings/o1js_node.bc.cjs:6761
         throw err;
         ^

RuntimeError: unreachable
    at __rg_oom (wasm://wasm/0128b55e:wasm-function[5142]:0x413aa7)
    at __rust_alloc_error_handler (wasm://wasm/0128b55e:wasm-function[5298]:0x41455c)
    at alloc::alloc::handle_alloc_error::rt_error::h59f27090ed20ea79 (wasm://wasm/0128b55e:wasm-function[5355]:0x41485b)
    at alloc::alloc::handle_alloc_error::hec284fc9005381fa (wasm://wasm/0128b55e:wasm-function[5354]:0x414850)
    at alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle::h092a2d70a2ea2754 (wasm://wasm/0128b55e:wasm-function[3996]:0x3f2841)
    at <o1_utils::serialization::SerdeAs as serde_with::ser::SerializeAs<T>>::serialize_as::hd65da13cc78980cb (wasm://wasm/0128b55e:wasm-function[2619]:0x38f5db)
    at kimchi::prover_index::_::<impl serde::ser::Serialize for kimchi::prover_index::ProverIndex<G,OpeningProof>>::serialize::h7b35f226f52736f7 (wasm://wasm/0128b55e:wasm-function[323]:0x1cd333)
    at caml_pasta_fp_plonk_index_encode (wasm://wasm/0128b55e:wasm-function[2035]:0x3520fe)
    at module.exports.caml_pasta_fp_plonk_index_encode (o1js-blobstream-nori/contracts/node_modules/o1js/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs:3005:14)
    at encodeProverKey (o1js-blobstream-nori/contracts/node_modules/o1js/dist/node/lib/proof-system/prover-keys.js:63:32)
    at write_ (o1js-blobstream-nori/contracts/node_modules/o1js/dist/node/lib/proof-system/zkprogram.js:331:54)

Node.js v22.11.0
valid zkp6?:  true
valid zkp4?:  true
valid zkp5?:  true
valid zkp7?:  true
valid zkp8?:  true
valid zkp9?:  true
valid zkp11?:  true
valid zkp10?:  true

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

2 participants