joyent/node — Issue #2481: Segfault when spawning 100+ processes
Author: chriso
Created: 2012-01-07 06:27:26+00:00
State: open

**test.js**

```javascript
var child = require('child_process');
for (var i = 0; i < 100; i++) {
child.spawn('echo');
}
```

Here's the GDB output:

```
~/Documents/node/curl master $ gdb /tmp/node-v0.6.7/out/Release/node
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done

(gdb) run test.js
Starting program: /private/tmp/node-v0.6.7/out/Release/node test.js
Reading symbols for shared libraries ++++++++++.......................................................................................................................... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000103dbd4b8
0x000000010026a8c9 in clear_pending (loop=0x1004ca3c0, w=0x100720b58) at ev.c:2609
2609	pendings [ABSPRI (w)][w->pending - 1].w = (W)&pending_w;
```