I run a local command console that probes twelve app URLs every sixty seconds and shows live CPU/RAM/disk gauges. It used to depend on systeminformation — a popular Node package that reads OS telemetry through native bindings and, on Windows, through WMI queries.
It never failed loudly. It just quietly took over.
Every poll to /api/system would hang for a few hundred milliseconds. After a few minutes the whole console stopped answering — not just the telemetry route, everything. The health probes, the project catalog, even a plain GET /. Restarting the process fixed it until the next hung poll piled up behind it. I spent a weekend chasing what I thought was a Vercel edge issue before realizing the bottleneck was running on my own laptop.
Here's what I learned, and why I deleted the dependency instead of upgrading it.
What systeminformation was doing
systeminformation is genuinely useful. It gives you CPU, memory, disk, battery, processes, and more through one clean API:
const si = require('systeminformation'); async function getStats() { const cpu = await si.currentLoad(); const mem = await si.mem(); return { cpu: cpu.currentLoad, mem: mem.used / mem.total }; } On Windows, many of those stats come from WMI — Windows Management Instrumentation. Each call shells out to WMI queries, waits for the repository to respond, parses the result, and returns it. That works fine when you call it once at startup.
I was calling it on a timer:
setInterval(async () => { const stats = await si.getStaticData(); // or currentLoad, mem, etc. systemSnapshot = stats; }, 2000); Every two seconds, a new WMI query. Node's event loop is single-threaded. A WMI call that takes 400ms blocks nothing directly — it's async — but the callback that parses and assigns the result runs on the loop. If a query hangs (WMI on Windows does this when the repository is locked, slow, or mid-rebuild), that callback never returns. The timer fires again. Another query stacks up. Eventually every scheduled tick is waiting on a WMI callback that will never fire, and the event loop is wedged.
The cruel part: this looks like your app is "slow," not dead. Health probes time out. The frontend spinner spins forever. You add more logging. You blame the network. You restart and it works again — until it doesn't.
What I replaced it with
Node's built-in os module plus fs.statfsSync. No native bindings, no WMI, no extra process, nothing that can hang the loop:
const os = require('os'); const fs = require('fs'); function sampleSystem() { const totalRam = os.totalmem(); const usedRam = totalRam - os.freemem(); let storagePercent = null; try { const stats = fs.statfsSync(path.parse(process.cwd()).root); const blocks = Number(stats.blocks); const free = Number(stats.bfree); if (blocks > 0) storagePercent = ((blocks - free) / blocks) * 100; } catch (err) { /* statfs unsupported: leave null */ } systemSnapshot = { cpuLoad: sampleCpuPercent(), ramUsed: Number((usedRam / (1024 ** 3)).toFixed(2)), ramTotal: Number((totalRam / (1024 ** 3)).toFixed(2)), ramPercent: Number(((usedRam / totalRam) * 100).toFixed(1)), storagePercent, uptimeSec: Math.round(os.uptime()), cores: os.cpus().length, cpuModel: os.cpus()[0]?.model.trim(), platform: os.platform(), hostname: os.hostname(), node: process.version }; } sampleSystem(); setInterval(sampleSystem, 2000); os.cpus(), os.totalmem(), os.freemem(), os.uptime() — all synchronous, all in-process, all return immediately. fs.statfsSync reads filesystem stats without WMI. Nothing shells out. Nothing can pile up.
I sample every 2 seconds and serve from memory. The /api/system route returns the last snapshot instantly, or 503 while the first sample is still warming up.
What I lost
I no longer get per-process stats, disk IO temperatures, battery details, or GPU temperature. I don't need those for a local console that shows four gauges. The tradeoff was explicit: observability that can take down the thing it's observing is not observability. It's a liability.
If I ever need deeper telemetry, I'll run it in a separate process and pipe results over a socket — never inline in the request path.
The broader point
This wasn't a systeminformation bug. It was my architecture bug: I put a blocking, third-party, system-call-heavy dependency on the critical path of a server that must answer in milliseconds. The package did exactly what it advertised. I used it wrong.
The fix wasn't a newer version. It was deletion.
What I'd check before adding any dependency again
From now on, every new dependency in this fleet answers four questions before it lands in package.json:
- Does it block the event loop, even indirectly? (WMI, native addons, shelling out — all suspect.)
- Can it hang forever, or does it have a hard timeout I control?
- Is it on the request path, or can it run out of band?
- If it wedges, does it take the whole server with it?
systeminformation failed question one on Windows. It's gone. The console answers in milliseconds again, and my own fleet health probes are green.
