Web Development · Backend
Node.js 26.11: --process-timeout and Histogram Diffs
Node.js 26.11.0 adds --process-timeout, histogram snapshots and diffs, Buffer.stringLength() and header validators. What to adopt, and the sqlite rename.
Abhishek Gupta
6 min read
Sponsored
Node.js 26.11.0 came out on October 7, 2026, and the most useful thing in it is a flag: --process-timeout. It makes a hung process exit with code 124 and tells you what was holding the event loop open. Install 26.11.1 though, not 26.11.0. The patch landed the same day and only reverts the documentation redesign, so nothing about the runtime differs, but it’s the build the project wants you on.
The rest of the release is a set of small additions that each fix a specific annoyance. Here is what I’d use, in order of how soon.
—process-timeout: a watchdog you don’t have to write
Every team has the same bug report. A CI job hangs for 40 minutes. A script that should take seconds never exits because something left a socket or a timer open. You find out when the runner times out and you get no clue why.
--process-timeout is a built-in answer:
node --process-timeout=5s server.js
If the process is still running after five seconds, measured from process start, Node exits with code 124 (the same code timeout(1) uses). It also prints what it knows. For an idle process you get a list of the resources keeping the event loop alive:
(node:25418) Process timed out after 5s (--process-timeout). Exiting with code 124.
Main thread was not executing JavaScript.
Resources keeping the event loop alive:
TCPServerWrap (listening on [::]:3000, fd 20)
Timeout x2 (next due in 2931ms)
If JavaScript was executing, you get a stack trace instead. Durations take ms, s, m or h. Add --report-on-process-timeout and you also get a diagnostic report.
Three things to know before you rely on it:
- It’s Stability 1.1, active development. The output format and the flag could change.
- The process exits without emitting
'beforeExit'or'exit'. Your cleanup code will not run, because that code may be the thing that’s stuck. Coverage and profile files (NODE_V8_COVERAGE,--cpu-prof) are still written. - If the main thread is blocked in a synchronous call such as
child_process.execSync()and doesn’t respond for two seconds, Node exits immediately with no stack trace and no resource list.
Where would I put it? Test runners and one-shot scripts, first. A failing job with a named leaked handle beats a hung job every time. It’s not a replacement for graceful shutdown on a long-running server, where a hard exit from a timer is the wrong tool.
Per-interval event loop delay, finally
If you’ve used monitorEventLoopDelay(), you know the catch. The histogram accumulates forever. To get “p99 over the last ten seconds” you call reset() after each read, and then every other consumer of that histogram loses its data.
26.11 adds histogram.snapshot() and histogram.diff(other). A snapshot is a point-in-time copy, and diff returns a new histogram holding only what was recorded after the earlier snapshot. Neither touches the original. The docs example:
const { monitorEventLoopDelay } = require('node:perf_hooks');
const histogram = monitorEventLoopDelay();
histogram.enable();
let previous = histogram.snapshot();
setInterval(() => {
const current = histogram.snapshot();
// After a reset, use everything recorded since the reset.
const delta = current.resetCount === previous.resetCount ?
current.diff(previous) : current;
console.log(delta.percentile(99));
previous = current;
}, 10_000);
The resetCount check matters. If somebody calls reset() between snapshots, a diff against the older one would be meaningless, and diff throws ERR_INVALID_STATE if values have been removed. The same release also fixes truncation in the monitorEventLoopDelay() resolution and lets RecordableHistogram record 0, so your p50 on a quiet service no longer lies.
This is the sort of change that rarely makes headlines and quietly improves dashboards. If you ship event loop lag as a metric, the diff approach is worth switching to. It pairs well with the tail-latency habits in our piece on hedged requests and load shedding.
Header validators that don’t throw
Until now, checking whether a string is a legal header name meant calling http.validateHeaderName() inside a try/catch. Exceptions are slow when invalid input is common, and a proxy or API gateway sees a lot of invalid input.
http.isValidHeaderName(name) and http.isValidHeaderValue(value[, options]) return a boolean:
import { isValidHeaderName } from 'node:http';
isValidHeaderName('content-type'); // true
isValidHeaderName('X-Request-Id'); // true
isValidHeaderName('bad header'); // false
isValidHeaderName(42); // false
isValidHeaderValue accepts httpValidation: 'strict' | 'relaxed', matching the option on http.createServer() and http.request(). Header names are HTTP tokens, so the name check also works for validating methods. If you forward user-supplied headers anywhere, this is the cleaner way to filter them, and it sits nicely alongside the checks in HTTP security headers.
Buffer.stringLength() and isLatin1
Buffer.byteLength(string) tells you how many bytes a string needs. Buffer.stringLength(input[, encoding]) is the missing opposite: how many UTF-16 code units a buffer would decode to, without decoding it.
const buf = Buffer.from('€ 100', 'utf8');
Buffer.stringLength(buf); // 5
Buffer.stringLength(buf, 'hex'); // 14
The use case is guarding against the maximum string length before you convert a large buffer. For UTF-8 it counts each maximal invalid byte sequence as one replacement character, just as decoding would. The release also adds buffer.isLatin1(input), which returns true if a string can be losslessly encoded as Latin-1, meaning every code unit is at or below U+00FF.
The sqlite rename
This is the item to look at in a diff. The release notes list “rename DatabaseSync and StatementSync” as a semver-minor change. In the sqlite docs, DatabaseSync is now described as a deprecated alias for Database, kept for backward compatibility. So your code won’t break today, but expect a deprecation path and plan to switch names when you next touch that code. Grep for DatabaseSync and StatementSync now so you know how many places it is.
Smaller items worth a line
process.refandprocess.unrefare now stable.http2takes aconnectionWindowSizeoption.- Alpine Linux is promoted to tier 2 platform support.
- Dependency bumps: OpenSSL 3.5.9, npm 11.20.0, undici 8.11.2.
- A large batch of Web Crypto fixes, plus faster synchronous random number generation.
Should you upgrade?
If you’re on 26.x Current, yes, to 26.11.1, after running your suite. If you’re on an LTS line (the latest LTS listed on nodejs.org is 24.21.0), none of this applies yet, and you shouldn’t switch lines for a flag. And if you’re weighing Node against alternatives right now, read how the runtimes compare first, given this week’s Deno news.
The concrete first step: add --process-timeout to your CI test command today. It’s the cheapest change in the release, and the first hung job it catches will pay for the afternoon.
Frequently asked questions
- Should I install Node.js 26.11.0 or 26.11.1?
- Install 26.11.1. It was released the same day and contains only reverts of the documentation redesign and related tooling commits, so the runtime behavior is the same as 26.11.0. There is no reason to deploy the first build.
- What does --process-timeout do?
- It exits the process with code 124 if it is still running after the given duration, measured from process start. The duration is a positive integer followed by ms, s, m or h, such as 30s or 5m. On timeout Node prints the resources keeping the event loop alive, or the stack trace if JavaScript was running. It is Stability 1.1, so the details may change.
- Is Node.js 26.11 safe to upgrade to from 26.10?
- The headline changes are semver-minor additions. The one change that touches existing code is the sqlite rename, and the old DatabaseSync name remains as a deprecated alias. Run your tests, but there is no listed breaking change.
- What is Buffer.stringLength() for?
- It returns how many UTF-16 code units buf.toString(encoding) would produce, without decoding the bytes. It is the counterpart of Buffer.byteLength(), and it lets you compare against the maximum string length before you attempt a conversion that could fail.
Sources
Sponsored
More from this category
More from Web Development
Sponsored
Discussion
Join the conversation.
Comments are powered by GitHub Discussions. Sign in with your GitHub account to leave a comment.
Sponsored