Skip to content

Commit 4059987

Browse files
authored
Merge pull request #59 from r33drichards/claude/fix-v8-init-ordering-Zq26M
Configure Rust tests to run sequentially
2 parents ca97351 + 25b50a9 commit 4059987

6 files changed

Lines changed: 20 additions & 0 deletions

File tree

server/.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[env]
2+
RUST_TEST_THREADS = "1"

server/fuzz/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ serde = ">=1.0,<1.0.220"
1717
[dependencies.server]
1818
path = ".."
1919

20+
[dependencies.deno_core]
21+
version = "0.381"
22+
2023
# Override rmcp to use the same git source as the server crate
2124
[patch.crates-io]
2225
rmcp = { git = "https://github.com/modelcontextprotocol/rust-sdk", rev = "787cc015b719773f66d4ac32e695b9a0079e12ef" }

server/fuzz/fuzz_targets/fuzz_execute_stateful.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ static INIT: Once = Once::new();
88

99
fn ensure_v8() {
1010
INIT.call_once(|| {
11+
// Disable V8 background threads (Maglev JIT, TurboFan, concurrent GC)
12+
// to prevent cumulative memory exhaustion across fuzz iterations.
13+
deno_core::v8::V8::set_flags_from_string("--single-threaded");
1114
server::engine::initialize_v8();
1215
});
1316
}

server/fuzz/fuzz_targets/fuzz_execute_stateless.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ static INIT: Once = Once::new();
88

99
fn ensure_v8() {
1010
INIT.call_once(|| {
11+
// Disable V8 background threads (Maglev JIT, TurboFan, concurrent GC)
12+
// to prevent cumulative memory exhaustion across fuzz iterations.
13+
deno_core::v8::V8::set_flags_from_string("--single-threaded");
1114
server::engine::initialize_v8();
1215
});
1316
}

server/fuzz/fuzz_targets/fuzz_snapshot_deserialization.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ static INIT: Once = Once::new();
66

77
fn ensure_v8() {
88
INIT.call_once(|| {
9+
// Disable V8 background threads (Maglev JIT, TurboFan, concurrent GC)
10+
// to prevent cumulative memory exhaustion across fuzz iterations.
11+
deno_core::v8::V8::set_flags_from_string("--single-threaded");
912
server::engine::initialize_v8();
1013
});
1114
}

server/fuzz/fuzz_targets/fuzz_wasm_compile.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ static INIT: Once = Once::new();
77

88
fn ensure_v8() {
99
INIT.call_once(|| {
10+
// Disable V8 background threads (Maglev JIT, TurboFan, concurrent GC)
11+
// to prevent cumulative memory exhaustion across fuzz iterations.
12+
// Without this, background compilation threads accumulate memory that
13+
// isn't freed between iterations, causing fatal OOM after ~2500 runs.
14+
// WASM compilation still works synchronously on the main thread.
15+
deno_core::v8::V8::set_flags_from_string("--single-threaded");
1016
server::engine::initialize_v8();
1117
});
1218
}

0 commit comments

Comments
 (0)