edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Chris Brannon <chris@the-brannons.com>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] suggest increasing the size argument to JS_NewRuntime
Date: Fri, 7 Feb 2014 14:26:02 +0000	[thread overview]
Message-ID: <20140207142602.GA29314@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <874n4bgj6f.fsf@mushroom.PK5001Z>

On Fri, Feb 07, 2014 at 05:13:12AM -0800, Chris Brannon wrote:
> Karl Dahlke <eklhad@comcast.net> writes:
> 
> > Or maybe js returns 0, like any malloc failure,
> > and I don't watch for that and then I segfault.
> 
> Yes, this is correct.  My wording was loose.  JS returns NULL somewhere
> because of an out of memory condition, and the program eventually
> segfaults because that NULL is passed along to a function that cannot
> deal with it.
> As you say, we need lots more error legs.  I think we've had that
> discussion, and no one has written them yet.
> So I'll get started on those today.

Sorry, that was probably something I should've done.

> > But that doesn't explain why Chris simple program segfaults on debian js.
> 
> Yes, that's a different issue entirely. My program on Debian doesn't 
> even make it past JS initialization.  It fails before it can even get a
> JS context.

Interestingly a new mozjs24d package hit the repo at some stage last night or this morning.
I upgraded, built edbrowse and it still breaks in exactly the same place.

> > My wrappers around malloc do indeed print and exit upon malloc failure,
> > which probably saves me about 3,000 lines of error leg programming,
> 
> No, when Spidermonkey runs out of memory, the "out of memory" message is
> printed via my_ErrorReporter() from jsdom.cpp.
> E.G., try browsing http://the-brannons.com/array.html with db2.

This prints the error, but doesn't segfault.
This suggests it's killing js due to the unhandled exception.
ON my machine it gets to around 55100 elements before it stops with an error,
but doesn't segfault.

I wonder if you add an exception handler which handles the error and continues
if this'd cause the issue.

> We could write another set of wrappers for JS functions.  E.G.,
> our_JS_NewObject, which causes an exit when JS_NewObject fails.

I need to double-check the docs to see what the failure return is.
If it's throwing an exception rather than returning on out of memory then I
wonder what condition causes it to return NULL.

Cheers,
Adam.

  reply	other threads:[~2014-02-07 14:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  6:30 Karl Dahlke
2014-02-07  8:26 ` Adam Thompson
2014-02-07 13:13 ` Chris Brannon
2014-02-07 14:26   ` Adam Thompson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-07  0:27 Chris Brannon
2014-02-07  8:13 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140207142602.GA29314@toaster.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    --cc=chris@the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).