boopus_the_snootusB
Deno3y ago
66 replies
boopus_the_snootus

`WARNING: v8::OwnedIsolate for snapshot was leaked` and/or crash after using snapshot

On startup, I create a runtime:
        let js_runtime = JsRuntimeForSnapshot::new(deno_core::RuntimeOptions {
            module_loader: Some(Rc::new(FsModuleLoader)),
            extensions: options.extensions,
            ..Default::default()
        });
        let snapshot = js_runtime.snapshot().to_vec();

Then I will recreate the runtime, since snapshot consumes it:
        let _snapshot = Snapshot::Boxed(snapshot.clone().into_boxed_slice());
        JsRuntimeForSnapshot::new(deno_core::RuntimeOptions {
            startup_snapshot: Some(_snapshot),
            module_loader: Some(Rc::new(FsModuleLoader)),
            ..Default::default()
        })


But the next time I reload from the snapshot in this way I get WARNING: v8::OwnedIsolate for snapshot was leaked, and some of the extensions result in a crash:
 (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) 


My extremely roundabout method here seems off to me
So how do I actually use snapshot correctly to avoid this
Was this page helpful?