#593

js-exec exits 124 long before maxJsTimeoutMs on 3.6.0

Openlaithalsaadoonopened 15d ago

just-bash version

3.6.0

Reproduction

import { Bash } from "just-bash";
const bash = new Bash({ javascript: true, executionLimits: { maxJsTimeoutMs: 120_000 } });
const r = await bash.exec(`js-exec -c 'let s = 0; for (let i = 0; i < 3e8; i++) s += i; console.log(s)'`);
console.log(r.exitCode, r.stdout.trim() || r.stderr.trim());

Expected behavior

0 44999999767108860, as on 3.4.2.

Actual behavior

124 js-exec: Execution timeout: exceeded 120000ms limit after 3 to 10 seconds. run 2.1.3 stops the guest after a fixed 10,000 interrupt checks (vercel-labs/run#76). With run 2.1.8 forced in (vercel-labs/run#78) it's 1 js-exec: JavaScript runtime exceeded its CPU time limit of 10000ms., because js-exec doesn't pass cpuTimeoutMs.

Could js-exec move to run 2.1.8, pass cpuTimeoutMs from maxJsTimeoutMs, and report RunCpuTimeoutError as exit 124?

Environment

Node 24.21.0, Linux x86_64

Activity

0

No activity yet.