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

Critical error on isolate.dispose with inspector session #497

Open
DPOH-VAR opened this issue Sep 28, 2024 · 3 comments
Open

Critical error on isolate.dispose with inspector session #497

DPOH-VAR opened this issue Sep 28, 2024 · 3 comments

Comments

@DPOH-VAR
Copy link

  • I have read the Frequently Asked Question in the README. My question is not the Frequently Asked Question.
  • JavaScript includes a setTimeout function: no
  • Functions are a type of primitive value in JavaScript: yes
  • Objects can be shared between isolates: no

this code causes an ctitical error

import IVM from "isolated-vm";
const isolate = new IVM.Isolate({inspector: true});
const inspector = isolate.createInspectorSession();

try {
    console.log("dispose - try");
    isolate.dispose(); // process.exit(-1073740791)
} finally {
    console.log("dispose - finally");
}
> node ./repro.js
dispose - try

> echo %errorlevel% 
-1073740791

I can fix it by dispose the inspector session before isolate:

import IVM from "isolated-vm";
const isolate = new IVM.Isolate({inspector: true});
const inspector = isolate.createInspectorSession();

try {
    console.log("dispose - try");
    inspector.dispose(); // need to dispose ALL sessions before isolate
    isolate.dispose();
} finally {
    console.log("dispose - finally");
}
@laverdet
Copy link
Owner

Did you try --no-node-snapshot

@DPOH-VAR
Copy link
Author

same result

>node --no-node-snapshot ./repro.js  
dispose - try

>echo %errorlevel%
-1073740791

@laverdet
Copy link
Owner

Yeah it seems that dangling inspector sessions could cause a deadlock. Doesn't seem to be an easy fix but I will keep an eye on this.

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