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.