Bug Report — Runtime APIs: [1.20260929.1 regression] a single console.log() from any worker crashes the whole workerd process and every co-hosted worker
In [email protected], a single console.log() of a value whose formatting throws aborts the whole workerd process. The worker's own try/catch cannot stop it, and every other service in the same process goes down with it — statically configured workers and Dynamic Workers alike — so one tenant can take down everything on a multi-tenant host. 1.20260928.1 is unaffected.
Repro: https://github.com/cnluzhang/workerd-console-crash-repro (npm install && npm test)
export default {
fetch() {
try {
console.log({ get [Symbol.toStringTag]() { throw Object.create(null); } });
} catch {
return new Response("caught");
}
return new Response("survived");
},
};Default workerd serve, no compatibility flags, with an unrelated static bystander worker on a second socket in the same process:
- [email protected]: bystander 200 → console worker 200 "survived" → bystander 200, process still running
- [email protected]: bystander 200 → console worker ECONNRESET → bystander ECONNREFUSED, process exited with code 1
*** Fatal uncaught std::exception: Uncaught JsExceptionThrownCause: formatLog()'s catch fallback (String(err) / err.stack) can itself throw, so handleLog()'s jsg::check(formatLog->Call(...)) raises jsg::JsExceptionThrown. Before #6874, wrapSimpleFunction()'s liftKj() caught it and the log line was dropped. #6874 (7d20e0abd) registers consoleDecorator directly via v8::Function::New() with no C++ exception boundary, so the exception unwinds to the top of the process.
Suggested fix: restore an exception boundary in consoleDecorator (e.g. jsg::liftKj), and ideally make formatLog()'s fallback non-throwing.
cc @dbezhetskov @jasnell
Source: cloudflare/workerd