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

Using the same isolate in multiple concurrent go-routines #120

Closed
cairns19 opened this issue Apr 20, 2021 · 2 comments
Closed

Using the same isolate in multiple concurrent go-routines #120

cairns19 opened this issue Apr 20, 2021 · 2 comments

Comments

@cairns19
Copy link

cairns19 commented Apr 20, 2021

I have some code that creates a VM / isolate once, and then pass the isolate into a go routine. Inside this go routine, I create a context from the isolate, and create a new object template.

This works fine for a little while, but then panics (as more than a handful go routines run concurrently). If I pass in a brand new isolate to each instance of the go routine, the panic won't happen.

Am I wrong thinking this ought to work?

@arctica
Copy link

arctica commented Apr 21, 2021

Isolates (or Contexts) are not goroutine safe. Even in v8 itself they are not threadsafe and require locking.

@cairns19
Copy link
Author

Thanks for clarifying!

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