Comments (3)
I'm not aware of any v8 limitations on multiple isolates in one thread, but I would strongly recommend against it as we may end up internalizing the the tokio runtime inside of the JsRuntime for performance reasons at some time in the future.
JsRealm
is intended to separate scripts from each other (they use a v8::Context internally), but realms are still in development and may have some sharp edges w.r.t. performance and security. For now, the best supported way to run parallel isolates is one-per-thread.
from deno_core.
Thank you for the JsRealm
tip. I don't see the performance nor security as an issue (all scripts will be written internally and will mostly be waiting for API responses). There will be 0 - 300 of them running in parallel, though.
I tried it and it works, but the implementation is kinda crazy 🙂 and I'm still missing the ability to "pause" and "cancel" individual JsRealm
s.
Feel free to close this issue (unless you'd like to keep it open with regards to the segfault). Thanks again
from deno_core.
@jsen- I think your problem maybe related to this issue: denoland/rusty_v8#639 .
The root cause is, v8::Isolate::new() included a call of v8::Isolate->Enter() and the drop() method of Isolate included a call of v8::Isolate->Exit(), which required isolates in a thread must destruct in last-in-first-out order.
If this is your case, then the simplest way to fix it is just use FuturesOrdered and its push_front() method to ensure JsRuntimes destruct in reversed order of create. But I recommend you just remove the Enter() and Exit() pair in rusty_v8 source code, as it has no sense in single thread embedding situation.
And as a deno_core user, I really don't like the idea to encapsulate tokio and thread-related things into deno_core. This way will limit the usage of deno_core in a very narrow scope. I beg you core developers to re-consider this idea @mmastrac .
from deno_core.
Related Issues (20)
- Fetching from Private NPM Repo Doesn't Work/Misleading User Feedback HOT 1
- op2 doesn't handle result with optional serde
- Assertion error with Jemalloc: 'assertion failed: layout.size() != 0' HOT 2
- Run runtime async? HOT 4
- `op2` doesn't support `Result<*mut c_void>`
- `op2` doesn't support `&mut [u8]` or `&mut [u32]` HOT 1
- `op2` doesn't support `#[smi] Option<ResourceId>`
- `op2`: String exceeding max length should throw `TypeError`, not `Error`
- `op_close` with `WasmStreamingResource` invokes JS from an op while `OpState` is borrowed HOT 6
- `op2` doesn't support `#[cfg]` attributes
- `op2` doesn't allow `#![allow()]` HOT 2
- `op2` doesn't support `&mut [u32]` HOT 1
- `op2` doesn't support `Option<JsBuffer>`
- `op2` doesn't support `serde_json::Value` HOT 1
- Possible bugs in resource recovery HOT 1
- `op2` doesn't support clippy suppressions HOT 3
- `op2` with `#[buffer]` attribute doesn't work in some cases HOT 2
- `op2` support `#[string]` with `Option<&str>` and `Option<Cow<str>>`
- Get additional properties present on `Error` class inside `JsError`
- Add more examples and docs about attribute "op2" and macro "extension!"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno_core.