Skip to main content
100%

Gist 597373

✓ Published0🌍 Public
CCaged
Last edited Sep 25, 2010
Created on Sep 25, 2010

This example shows a Node.js script that attempts to process crime incident data from a CSV file using the `ecsv` library, but it fails due to a system resource limit. The code calls `exec('wc -c "foo"', ...)` inside the `ecsv.each` callback for every row, spawning a new child process for each record. The visible stack trace from `child_process.spawn` reveals the error "Too many open files," indicating the script exhausts file descriptors because it launches processes asynchronously without waiting for completion. The gist demonstrates a common anti-pattern where unthrottled asynchronous process spawning overwhelms the operating system, using only Node.js core APIs (`child_process.exec`, `fs`) and the third-party `ecsv` parser.

AI-generated description

Similar vizzes