Skip to content

Commit ad98744

Browse files
authored
Merge pull request #227 from nyannyacha/fix-pku-jit
fix: crash when V8 tries to JIT compilation in the PKU-supported environment
2 parents 3be151f + d83e87b commit ad98744

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/base/src/commands.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::server::{Server, ServerCodes, WorkerEntrypoints};
22
use anyhow::Error;
3+
use deno_core::JsRuntime;
34
use tokio::sync::mpsc::Sender;
45

56
#[allow(clippy::too_many_arguments)]
@@ -13,6 +14,11 @@ pub async fn start_server(
1314
callback_tx: Option<Sender<ServerCodes>>,
1415
entrypoints: WorkerEntrypoints,
1516
) -> Result<(), Error> {
17+
// NOTE(denoland/deno/20495): Due to the new PKU (Memory Protection Keys)
18+
// feature introduced in V8 11.6, We need to initialize the V8 platform on
19+
// the main thread that spawns V8 isolates.
20+
JsRuntime::init_platform(None);
21+
1622
let mut server = Server::new(
1723
ip,
1824
port,

0 commit comments

Comments
 (0)