On Sun, May 12, 2013 at 6:24 AM, Alex Kocharin <[email protected]> wrote:
> Hi everyone,
>
> I wonder if it would make sense to recommend everyone to set "ulimit -n" to
> unlimited when using node... I seem to run into issues with it every now and
> then.
>
> Anyway, it seems that node.js core itself has serious trouble with it. I
> used "ab -n 10000 -c 5000" to bombard a simple http server with thousands of
> requests, and after that node.js starts to eat up 100% CPU and never returns
> control to javascript. HTTP port remains open, but connection is closed as
> soon as anybody connects to it.
>
> Can you recheck it? Maybe I have some silly settings on my computer that
> cause this.
>
> Tested several versions. 0.8.23 fails with EMFILE (this is to be expected),
> 0.8.7 and 0.9.1 handles anything successfully (surprising, but ok), but all
> versions starting I believe from 0.9.2 including current version have this
> issue.
>
> I wonder if it's a security issue, and everybody can freeze node.js server
> by just opening 2k connections to it.
>
>
> I'm using this for testing:
> ```
> setInterval(function() {
>    console.log('I\'m alive, ', Date.now());
> }, 1000);
>
> require('http').createServer(function(req, res) {
>    res.end('xxx');
> }).listen(12345);
> ```
>
> In another console (under root because ordinary user can't up ulimit by
> himself):
> # ulimit -n 10000
>
> # ab -n 10000 -c 5000 http://127.0.0.1:12345/
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking 127.0.0.1 (be patient)
> apr_socket_recv: Connection reset by peer (104)
> Total of 59 requests completed
>
> # ps aux | grep node
> alex      4582 91.7  0.2 592480 11192 pts/11   Rl+  12:58   0:31 node
> /tmp/test.js
> root      4596  0.0  0.0   8976   876 pts/4    S+   12:59   0:00 grep node
>
> # time telnet 127.0.0.1 12345
> Trying 127.0.0.1...
> Connected to 127.0.0.1.
> Escape character is '^]'.
> Connection closed by foreign host.
>
> real    0m0.004s
> user    0m0.004s
> sys     0m0.000s

See [1], it'll be fixed in v0.10.6.  It's an artifact of how the
accept4() syscall checks for EMFILE.

[1] https://github.com/joyent/libuv/commit/b3ab332

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to