Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Segmentation Fault
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Felix Geisendörfer  
View profile  
 More options Jun 26 2009, 2:43 pm
From: Felix Geisendörfer <haimu...@gmail.com>
Date: Fri, 26 Jun 2009 11:43:18 -0700 (PDT)
Local: Fri, Jun 26 2009 2:43 pm
Subject: Segmentation Fault
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!

-- Felix Geisendörfer aka the_undefined


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felix Geisendörfer  
View profile  
 More options Jun 26 2009, 2:48 pm
From: Felix Geisendörfer <haimu...@gmail.com>
Date: Fri, 26 Jun 2009 11:48:52 -0700 (PDT)
Local: Fri, Jun 26 2009 2:48 pm
Subject: Re: Segmentation Fault
More observations:

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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ry  
View profile  
 More options Jun 26 2009, 5:13 pm
From: ry <coldredle...@gmail.com>
Date: Fri, 26 Jun 2009 14:13:24 -0700 (PDT)
Local: Fri, Jun 26 2009 5:13 pm
Subject: Re: Segmentation Fault
Thanks -
 It would be more proper to buffer the output and send the response in
the "onExit" callback:

  new node.http.Server(function (req, res) {
    var ls = new node.Process("ls -lah");
    var output = "";

    ls.onOutput = function(chunk) {
      if (chunk) output += chunk;
    };

    ls.onExit = function () {
      res.sendHeader(200, [["Content-Type", "text/plain"]]);
      res.sendBody(output);
      res.finish();
    };
  }).listen(8001);

As the "onOutput" will be called more than once. Nevertheless, this is
still segfaulting.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ryan dahl  
View profile  
 More options Jun 26 2009, 6:16 pm
From: ryan dahl <coldredle...@gmail.com>
Date: Sat, 27 Jun 2009 00:16:04 +0200
Local: Fri, Jun 26 2009 6:16 pm
Subject: Re: Segmentation Fault
Fixed in 5ab9350

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Hammond  
View profile  
 More options Jun 26 2009, 6:56 pm
From: Brian Hammond <or.else.it.gets.the.h...@gmail.com>
Date: Fri, 26 Jun 2009 18:56:33 -0400
Local: Fri, Jun 26 2009 6:56 pm
Subject: Re: Segmentation Fault
I'm wondering what's going on in the following example.

It seems related to this.

I'm using the 5ab9350 version.

Running the sample from tinyclouds.org/node

new node.http.Server(function (req, res) {
   setTimeout(function () {
     res.sendHeader(200, [["Content-Type", "text/plain"]]);
     res.sendBody("Hello World");
     res.finish();
   }, 2000);

}).listen(8000, {backlog:8192});

puts("Server running at http://127.0.0.1:8000/");

Then benchmarking with 'ab' I see the following:

$ ab -n 10000 -c 1000 http://myhost/
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 myhost (be patient)
Completed 1000 requests
Completed 2000 requests
apr_socket_recv: Connection reset by peer (54)
Total of 2589 requests completed

Sometimes the 'ab' completes all calls and sometimes fails with  
connection reset by peer.

The backlog I'm playing with was 1024 and 8192.  Same erratic behavior  
with both.

Any idea what's going on?  Sure, I'm stressing it out but I'd like to  
know what's being broken by this level of stress at least.

Thanks,
Brian

On Jun 26, 2009, at 6:16 PM, ryan dahl wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ryan dahl  
View profile  
 More options Jun 26 2009, 7:20 pm
From: ryan dahl <coldredle...@gmail.com>
Date: Sat, 27 Jun 2009 01:20:52 +0200
Local: Fri, Jun 26 2009 7:20 pm
Subject: Re: Segmentation Fault

> Benchmarking myhost (be patient)
> Completed 1000 requests
> Completed 2000 requests
> apr_socket_recv: Connection reset by peer (54)
> Total of 2589 requests completed

My first inclination is to suspect some operating system boundary (eg
on number of open connections).On my system, for example, this works.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Hammond  
View profile  
 More options Jun 26 2009, 9:03 pm
From: Brian Hammond <or.else.it.gets.the.h...@gmail.com>
Date: Fri, 26 Jun 2009 21:03:50 -0400
Local: Fri, Jun 26 2009 9:03 pm
Subject: Re: Segmentation Fault
Hmmm I have nofiles set to 256000 and ulimit -n 256000.

What system are you running on and how do you have such limits  
configured?  I'd like it to work too!

:)

On Jun 26, 2009, at 7:20 PM, ryan dahl <coldredle...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Felix Geisendörfer  
View profile  
 More options Jun 27 2009, 6:51 am
From: Felix Geisendörfer <haimu...@gmail.com>
Date: Sat, 27 Jun 2009 03:51:03 -0700 (PDT)
Local: Sat, Jun 27 2009 6:51 am
Subject: Re: Segmentation Fault
Hey ryan,

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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ryan dahl  
View profile  
 More options Jun 28 2009, 6:34 am
From: ryan dahl <coldredle...@gmail.com>
Date: Sun, 28 Jun 2009 12:34:03 +0200
Local: Sun, Jun 28 2009 6:34 am
Subject: Re: Segmentation Fault
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »