Skip to content

Commit 168be6d

Browse files
authored
Disable parallel compilation during fuzzing (bytecodealliance#10035)
The intention has always been to disable parallel compilation during fuzzing and this was previously achieved with a single-thread pool for Rayon. This still spawns a rayon thread though and can offload work to it, so this instead explicitly uses `wasmtime::Config` to disable parallel compilation. This should ensure that `rayon` doesn't get used at runtime, as desired, and additionally avoids spawning threads or offloading work onto a thread.
1 parent be6c6c8 commit 168be6d

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/fuzzing/src/generators/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ impl Config {
246246
log::debug!("creating wasmtime config with {:#?}", self.wasmtime);
247247

248248
let mut cfg = wasmtime::Config::new();
249-
cfg.wasm_bulk_memory(true)
249+
cfg.parallel_compilation(false)
250+
.wasm_bulk_memory(true)
250251
.wasm_reference_types(self.module_config.config.reference_types_enabled)
251252
.wasm_multi_value(self.module_config.config.multi_value_enabled)
252253
.wasm_multi_memory(self.module_config.config.max_memories > 1)

crates/fuzzing/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,5 @@ pub fn init_fuzzing() {
2727

2828
INIT.call_once(|| {
2929
let _ = env_logger::try_init();
30-
31-
let _ = rayon::ThreadPoolBuilder::new()
32-
.num_threads(1)
33-
.build_global();
34-
})
30+
});
3531
}

0 commit comments

Comments
 (0)