From d83e87bbc2fa7f15c3180e4b0831599e14129379 Mon Sep 17 00:00:00 2001 From: Nyannyacha Date: Wed, 6 Dec 2023 03:23:45 +0000 Subject: [PATCH] fix: crash when V8 tries to JIT compilation in the PKU-supported environment --- crates/base/src/commands.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/base/src/commands.rs b/crates/base/src/commands.rs index d2105dd3f..87f92bd75 100644 --- a/crates/base/src/commands.rs +++ b/crates/base/src/commands.rs @@ -1,5 +1,6 @@ use crate::server::{Server, ServerCodes, WorkerEntrypoints}; use anyhow::Error; +use deno_core::JsRuntime; use tokio::sync::mpsc::Sender; #[allow(clippy::too_many_arguments)] @@ -13,6 +14,11 @@ pub async fn start_server( callback_tx: Option>, entrypoints: WorkerEntrypoints, ) -> Result<(), Error> { + // NOTE(denoland/deno/20495): Due to the new PKU (Memory Protection Keys) + // feature introduced in V8 11.6, We need to initialize the V8 platform on + // the main thread that spawns V8 isolates. + JsRuntime::init_platform(None); + let mut server = Server::new( ip, port,