-
Notifications
You must be signed in to change notification settings - Fork 288
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
Unable to use multiple instances of UltraHonkBackend #11113
Comments
This looks like an issue with bun where worker.terminate() simply terminate the process. I tried below code with nodejs and bun async function test() {
const circuit = readCircuitFromFile("simple")
const inputs = { x: 1, y: 2 }
const noir = new Noir(circuit)
const { witness } = await noir.execute(inputs)
const prover = new UltraHonkBackend(circuit.bytecode, { threads: 1 }, { recursive: true })
console.log("Instantiating prover 1")
await prover.instantiate() // <--- This never returns
console.log("Generating proof 1")
await prover.generateProof(witness)
console.log("Cleaning up prover 1")
await prover.destroy()
const prover2 = new UltraHonkBackend(circuit.bytecode, { threads: 1 }, { recursive: true })
console.log("Instantiating prover 2")
await prover2.instantiate()
console.log("Generating proof 2")
await prover2.generateProof(witness)
console.log("Cleaning up prover 2")
await prover2.destroy()
console.log("Prover 2 destroyed")
}
test().then(() => {
console.log("Done")
}).catch((error) => {
console.error(error)
}) With bun bun run test.js
Solving witness
Instantiating prover
Generating proof
Cleaning up prover With nodejs
Bun is not even throwing any error; simply exits when prover2 is instantiated. The problem goes away when I comment out worker_thread.destroy() in bb.js |
This worked, thanks @saleel! Disappointing that the issue was with bun, especially since we're using |
Good to hear that. I have seen another weird bun issue in regards to bb wasm, but it was gone in a newer version of bun. Hopefully this one also gets resolved in the future. |
Issue
When using multiple instances of
UltraHonkBackend
, calling.destroy()
on one of them (to clean it up and allow WASM memory to be freed) causes all other instances to subsequently fail to initialise, and hang forever when.instantiate()
is called on them.This is currently an issue for ZKpassport's integration tests. See this related issue.
Versions
@aztec/bb.js
version0.69.1
@noir-lang/noir_js
version1.0.0-beta.1
To reproduce
Sample code
I've created a repo reproducing the issue here. See this line for where it hangs.
The text was updated successfully, but these errors were encountered: