mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 00:01:34 +00:00
fix: add 32MB memory limit to QuickJS runtime for flow expressions
QuickJS was missing an explicit memory limit, unlike deno_core which has a 128MB heap limit. This adds a 32MB limit appropriate for lightweight flow expression evaluation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,11 @@ pub async fn eval_timeout_quickjs(
|
||||
})??
|
||||
}
|
||||
|
||||
/// Memory limit for QuickJS runtime (32MB).
|
||||
/// This is much smaller than deno_core's 128MB limit since flow expressions
|
||||
/// should be lightweight transformations, not memory-intensive operations.
|
||||
const QUICKJS_MEMORY_LIMIT: usize = 32 * 1024 * 1024;
|
||||
|
||||
async fn eval_quickjs_inner(
|
||||
expr: &str,
|
||||
transform_context: HashMap<String, Arc<Box<RawValue>>>,
|
||||
@@ -156,6 +161,7 @@ async fn eval_quickjs_inner(
|
||||
context_keys: Vec<String>,
|
||||
) -> anyhow::Result<Box<RawValue>> {
|
||||
let runtime = AsyncRuntime::new()?;
|
||||
runtime.set_memory_limit(QUICKJS_MEMORY_LIMIT).await;
|
||||
let context = AsyncContext::full(&runtime).await?;
|
||||
|
||||
// Create shared state for async ops if we have a client
|
||||
|
||||
Reference in New Issue
Block a user