Stack Insight Logo

Home Docs Blog
  • Stream Leaks: A Four-Case Simulation Study of How createReadStream Without destroy() Causes Dual EMFILE and OOM Failures

    Stream Leaks: A Four-Case Simulation Study of How createReadStream Without destroy() Causes Dual EMFILE and OOM Failures

    We built a discrete-event stream simulator and ran four two-dimensional parameter grid experiments to measure how stream leak probability, concurrency, file size, error handling, and stream type interact to cause EMFILE and OOM failures. Unlike raw file descriptor leaks, streams retain their read buffers in heap memory — 1,024 leaked read streams hold 64MB, transform streams hold 80MB. Without stream.destroy() on error paths, a 10% error rate at 20% base leak causes 68.8% request failure. This is Part 3 of our resource leak study, focusing on BM-03: Node.js stream leaks.

    View on GitHub

    Mar 19, 2026

  • HTTP Socket Exhaustion: A Five-Case Simulation Study of How http.request() Leaks Destroy Node.js Services

    HTTP Socket Exhaustion: A Five-Case Simulation Study of How http.request() Leaks Destroy Node.js Services

    We built a discrete-event HTTP socket simulator and ran five two-dimensional parameter grid experiments to measure how socket leak probability, concurrency, timeout, response size, error handling, and keep-alive interact to cause socket pool exhaustion. A 1% socket leak at concurrency 10 consumes 88% of the 50-socket pool in a single simulation. Without socket.destroy() on timeout, a 1% error rate causes 29% failure and socket exhaustion in 16.5 seconds. Keep-alive connections with a finite pool cause 87.5% failure even at zero intentional leak. This is Part 4 of our resource leak study, focusing on BM-04: HTTP socket accumulation.

    View on GitHub

    Mar 19, 2026

  • Timer Leaks: A Four-Case Simulation Study of How setInterval Without clearInterval Silently Saturates Node.js

    Timer Leaks: A Four-Case Simulation Study of How setInterval Without clearInterval Silently Saturates Node.js

    We built a discrete-event timer simulator and ran four two-dimensional parameter grid experiments to measure how timer leak probability, creation rate, closure size, interval frequency, and timer type interact to degrade Node.js performance. Unlike file descriptors or sockets, timers have no hard OS limit. Damage accumulates as heap growth from closure capture and CPU overhead from leaked setInterval callbacks firing indefinitely. At 1ms interval with 100 timers/second creation, leaked intervals generate 45 million callbacks in 30 seconds, saturating the event loop at 50ms mean latency. This is Part 5 of our resource leak study, focusing on BM-05: timer leaks.

    View on GitHub

    Mar 19, 2026

  • Event Listener Leaks: A Five-Case Simulation Study of How emitter.on() Without off() Degrades Node.js Services

    Event Listener Leaks: A Five-Case Simulation Study of How emitter.on() Without off() Degrades Node.js Services

    We built a discrete-event event listener simulator and ran five two-dimensional parameter grid experiments to measure how listener leak probability, listener count, closure size, event frequency, emitter topology, and listener type interact to cause MaxListenersExceeded warnings, heap growth, and emit latency degradation. At 100 listeners per emitter with 10% leak rate, MaxListeners threshold is exceeded immediately. Emit latency scales linearly with listener count: 1,000 listeners = 30ms per emit. emitter.once() is no safer than emitter.on() if the event never fires. This is Part 6 of our resource leak study, focusing on BM-06: event listener leaks.

    View on GitHub

    Mar 19, 2026

  • Connection Pool Exhaustion: A Five-Case Simulation Study of How 1% Leak Rates Kill Production Node.js Services

    Connection Pool Exhaustion: A Five-Case Simulation Study of How 1% Leak Rates Kill Production Node.js Services

    We built a discrete-event connection pool simulator and ran five two-dimensional parameter grid experiments to measure how leak probability, concurrency, query time, pool size, burst patterns, error handling, and DB connection limits interact to cause production failures. A 1% leak rate at concurrency 10 causes 49% request failure. Without error-path cleanup, a 1% error rate exhausts a 20-connection pool in 3.4 seconds. This is Part 1 of our resource leak study, focusing on BM-01: database connection pool exhaustion.

    View on GitHub

    Mar 17, 2026

  • Angular 21 SSR Local Development: What Changed, What Broke, and How to Fix It

    Angular 21 SSR Local Development: What Changed, What Broke, and How to Fix It

    Angular 21 broke almost every SSR local dev pattern from Angular 20. Here's everything that changed, every error we hit, and the working setup that actually runs SSR on your machine.

    Mar 4, 2026

  • The Missing Index Crisis: A 40-Repo Scan and Five-Module Benchmark Study of Prisma and PostgreSQL

    The Missing Index Crisis: A 40-Repo Scan and Five-Module Benchmark Study of Prisma and PostgreSQL

    We scanned 40 production Prisma repositories and found 1,209 missing index patterns. Then we benchmarked five scenarios against PostgreSQL at four dataset sizes (1K–1M rows) with 30 trials each. FK scan without an index: 153× slower. ORDER BY without an index: 190× slower. Point lookup: 26× slower. The one surprise: covering indexes showed zero measurable benefit because PostgreSQL chose sequential scan regardless. All findings, raw data, and the static detector are open source.

    View on GitHub

    Feb 25, 2026

  • Loop Performance Anti-Patterns: A 40-Repository Scan and Six-Module Benchmark Study

    Loop Performance Anti-Patterns: A 40-Repository Scan and Six-Module Benchmark Study

    We scanned 40 open-source repositories (20 JavaScript, 20 Python) for loop anti-patterns and benchmarked six common inefficiencies across five input sizes with 30 trials each. The surprise: V8's JIT optimizer neutralizes most textbook anti-patterns — regex hoisting and array method fusion showed negligible speedup. But replacing O(n²) nested loops with Map lookups delivered 64× improvement, and hoisting JSON.parse out of loops yielded 46×. This article presents the full data, scaling analysis, and an honest assessment of which loop optimizations actually matter.

    View on GitHub

    Feb 20, 2026

  • Frontend Memory Leaks: A 500-Repository Static Analysis and Five-Scenario Benchmark Study

    Frontend Memory Leaks: A 500-Repository Static Analysis and Five-Scenario Benchmark Study

    We scanned 500 public React, Vue, and Angular repositories with AST-based static analysis and found 55,864 missing-cleanup patterns — 86% of repos had at least one. Then we benchmarked five common leak scenarios (useEffect listeners, onMounted timers, RxJS subscriptions, Vue watchers, RAF) across 100 mount/unmount cycles with 50 repeats. Every pattern leaked ~8 KB per cycle. This article presents the full data, statistical validation, framework comparison, and one-line fixes.

    View on GitHub

    Feb 17, 2026

  • We Scanned 250 Node.js Repos for Blocking I/O. 76% Had It — and the Benchmarks Explain Why That Matters.

    We Scanned 250 Node.js Repos for Blocking I/O. 76% Had It — and the Benchmarks Explain Why That Matters.

    We ran AST-based static analysis across 250 public Node.js repositories and found 10,609 synchronous I/O calls. Then we benchmarked five common patterns under 100 concurrent connections. execSync in a request handler dropped throughput by 280x. Here's the full data.

    View on GitHub

    Feb 14, 2026

Page 2 of 4
Previous 1234 Next
 Stack Insight
About Contact Privacy Policy
© 2026 StackInsight.dev. All rights reserved.