Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

nodejs v0.6.6 segfault if out of sockets #2439

Closed
exi opened this issue Dec 30, 2011 · 4 comments
Closed

nodejs v0.6.6 segfault if out of sockets #2439

exi opened this issue Dec 30, 2011 · 4 comments
Labels

Comments

@exi
Copy link

exi commented Dec 30, 2011

If if have >100 open connections within one nodejs process, node segfaults:

this is probably because i reach the connection limit for my kernel, but it should be handled by an exception when trying to open a new connection.

system: debian 6.0 64bit
node tag v0.6.6 from git

compiled under user prefix with ./configure --prefix=/home/exi/node --gdb --debug

backtrace:

#0  0x000000000081559f in clear_pending (loop=0xc58460, w=0x7fffe8368738) at src/unix/ev/ev.c:2609
No locals.
#1  0x000000000081679c in ev_child_stop (loop=0xc58460, w=0x7fffe8368738) at src/unix/ev/ev.c:3001
No locals.
#2  0x0000000000804baa in uv_close (handle=0x7fffe83686e0, closconnectionse_cb=0x559710 <node::HandleWrap::OnClose(uv_handle_s*)>) at src/unix/core.c:141
    udp = 0x193ef6f91319
    async = 0x0
    timer = 0x58b5b9
    stream = 0x7fffffffcf28
    process = 0x7fffe83686e0
    __PRETTY_FUNCTION__ = "uv_close"
#3  0x0000000000559c1f in node::HandleWrap::Close (args=...) at ../src/handle_wrap.cc:103
    scope = {isolate_ = 0xc6a1a0, prev_next_ = 0xca2c50, prev_limit_ = 0xca4880, is_closed_ = false}
    __PRETTY_FUNCTION__ = "static v8::Handle<v8::Value> node::HandleWrap::Close(const v8::Arguments&)"
#4  0x00000000005b1887 in v8::internal::Builtin_HandleApiCall(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>, v8::internal::Isolate*) ()
@ry
Copy link

ry commented Dec 30, 2011

can you should us how to reproduce? That shouldn't be happening.

@exi
Copy link
Author

exi commented Dec 30, 2011

ok, i just tried to reproduce it with a simple server, just flooding it with connections but i can't.
but i have a nodejs app where i can reproduce this.
i'll try to look into it.

@exi
Copy link
Author

exi commented Dec 31, 2011

the bug actually resides in the child_process module.
i am calling mime-magic on nearly every file i serve, to determine it's mime type. mime-magic uses execFile to use the linux file utility to determine the type.

this code triggers the bug for me:

var p = require('path');
var cp = require('child_process');
var maxtries = 500;
var fileExec = p.resolve(__dirname + '/../bin/file');
var dostuf = function(n) {
    console.log(n)
    cp.execFile(fileExec, ["dontmatter"], function (err, stdout) {
        stdout = stdout.trim();
        if (err) {
            if (stdout) {
                err.message = stdout;
            }
        }
    });
}
for (var i = 0; i<maxtries; i++) {
    dostuf(i);
}

output (last lines):

336
337
338
[1]    7368 segmentation fault  node bug.js```

@bnoordhuis
Copy link
Member

Thanks for the report. It's fixed in b07acb3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants