Skip to content

Commit

Permalink
fix: crash when V8 tries to JIT compilation in the PKU-supported envi…
Browse files Browse the repository at this point in the history
…ronment
  • Loading branch information
nyannyacha committed Dec 6, 2023
1 parent c659974 commit d83e87b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/base/src/commands.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -13,6 +14,11 @@ pub async fn start_server(
callback_tx: Option<Sender<ServerCodes>>,
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,
Expand Down

0 comments on commit d83e87b

Please sign in to comment.