Just started playing around with node.js, absolutely impressive &
fantastic so far.
Anyway, I think I found an easily reproducible segmentation fault:
seg_fault.js
------------------------------------------------------
new node.http.Server(function (req, res) {
var ls = new node.Process("ls -lah");
ls.onOutput = function(chunk) {
res.sendHeader(200, [["Content-Type", "text/plain"]]);
res.sendBody(chunk || "");
res.finish();
};
}).listen(8001);
puts("Server running at http://127.0.0.1:8001/");
------------------------------------------------------
triggering the seg fault:
------------------------------------------------------
$ ab -n 1000 http://localhost:8001/ Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Test aborted after 10 failures
apr_socket_connect(): Connection refused (61)
Total of 379 requests completed
------------------------------------------------------
The fact that no matter how often I run this I always gets the
segfault at exactly 379 connections makes me think it's probably some
system process limit being hit. Speaking of which, I used Ubuntu 9.04
Server Edition for my tests.
Anyway, let me know if I can be of any help providing more data. Keep
up the fantastic work!
Changing the process to "ls" (less output) causes the segfault to move
up to 449 requests.
So I am now more thinking that garbage collection might be the issue.
However, putting a "ls.close()" and/or a "delete ls" statement in my
onOutput closure seems to have no effect on the segfault - not sure if
that's expected or not.
-- Felix
On Jun 26, 8:43 pm, Felix Geisendörfer <haimu...@gmail.com> wrote:
> triggering the seg fault:
> ------------------------------------------------------
> $ ab -n 1000http://localhost:8001/ > Benchmarking localhost (be patient)
> Completed 100 requests
> Completed 200 requests
> Completed 300 requests
> Test aborted after 10 failures
> apr_socket_connect(): Connection refused (61)
> Total of 379 requests completed
> ------------------------------------------------------
> The fact that no matter how often I run this I always gets the
> segfault at exactly 379 connections makes me think it's probably some
> system process limit being hit. Speaking of which, I used Ubuntu 9.04
> Server Edition for my tests.
> Anyway, let me know if I can be of any help providing more data. Keep
> up the fantastic work!
thanks for the incredibly fast fix. I just ran the test on a fresh
build from GitHub and the segfault is gone indeed. However, I now am
seeing a not quite as consistently reproducible error when running the
same test. Only this time node reports this:
root@vbox:~# node example.js
Server running at http://127.0.0.1:8001/ V8 FATAL ERROR. v8::External::Cast() Could not convert to external
This usually happens after running the ab test with a few thousand
connections, but sometimes as early as a few hundred.
Let me know if there is anything else I might be able to provide you
with!
Best Regards,
-- Felix Geisendörfer
root@vbox:~# node example.js
Server running at http://127.0.0.1:8001/ V8 FATAL ERROR. v8::External::Cast() Could not convert to external
On Jun 27, 12:16 am, ryan dahl <coldredle...@gmail.com> wrote:
2009/6/27 Felix Geisendörfer <haimu...@gmail.com>:
> thanks for the incredibly fast fix. I just ran the test on a fresh > build from GitHub and the segfault is gone indeed. However, I now am > seeing a not quite as consistently reproducible error when running the > same test. Only this time node reports this:
> root@vbox:~# node example.js > Server running at http://127.0.0.1:8001/ > V8 FATAL ERROR. v8::External::Cast() Could not convert to external
> This usually happens after running the ab test with a few thousand > connections, but sometimes as early as a few hundred.
> Let me know if there is anything else I might be able to provide you > with!
Hi -
You should use my modified version - there is an error in the original.
Node ought to raise an exception (and not crash with fatal error) when one tries to call sendHeader but already has done so - I've opened an issue for this: http://github.com/ry/node/issues/#issue/13