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

Run hello_world twice and it'll error with "Invalid global state" - same with other examples #1325

Open
matteliot opened this issue Sep 17, 2023 · 1 comment

Comments

@matteliot
Copy link

Hi, if you take one of the examples like hello_world and run the code twice, it'll give the error "Invalid global state".

From what I can see, it's in the deno code so this doesn't appear to be a bug, but shouldn't the any state be eliminated after the 2 disposals?

If I call get_current_platform rather than the initializations I can get subsequent hello_worlds to run without error, but is there a way to force the runtime to reset back to the initial state? It doesn't seem like dispose and dispose_platform do anything- are there other calls that are needed?

Thanks

//call this twice and it'll give "thread 'main' panicked at 'Invalid global state'" 
fn bomb(){
    let platform = v8::new_default_platform(0, false).make_shared();
    v8::V8::initialize_platform(platform);
    v8::V8::initialize();

    unsafe {
        v8::V8::dispose();
    }
    v8::V8::dispose_platform();
}

asdasd

@lucacasonato
Copy link
Member

You should not initialise the platform more than once. Platform must only be initalized exactly once per process.

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