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] out of memory errors
Date: Sun, 23 Feb 2014 19:38:44 +0000	[thread overview]
Message-ID: <20140223193844.GD15819@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <877g8l659k.fsf@mushroom.PK5001Z>

On Sun, Feb 23, 2014 at 10:41:27AM -0800, Chris Brannon wrote:
> I'm seeing unhandled out-of-memory conditions in domLink and in
> handlerSet.  One of these is eventually ending in a segfault.  I can't
> tell which one.
> 
> Example from jsdom.cpp, line 1522:
> 				if (JS_DefineProperty(cw->jss->jcx, owner,
> 						  idname, vv, NULL, NULL, attr) == JS_FALSE)
> return NULL;
> 
> The failed domLink calls produce hundreds of "out of memory" messages.
> We're doing error checking and returning NULL on error, but
> javaSessionFail is never called.

Sorry that was my fault and comes from (I think)
when javaSessionFail destroyed context.
I think the idea at the time was to  put return checks on the
domLink calls, but given the way things work now,
I've just fixed (and pushed the changes to)
domLink to call javaSessionFail and return NULL as I was looking through the 
code  anyway.

> handlerSet is a little more complicated, because it calls
> JS_CompileFunction, which can fail for lots of reasons such as a syntax
> error.  We're not doing any error checking there at all, but we should
> at least try to catch the out of memory condition.

Yeah, we should.
> So I wonder about adding the call to javaSessionFail(); to
> my_ErrorReporter directly:
> 
> 	if (report && report->errorNumber == JSMSG_OUT_OF_MEMORY ||
> 	    message && strstr(message, "out of memory")) {
> 		i_puts(MSG_JavaMemError);
> 		javaSessionFail();
> }

Looks good. Out of interest are there really cases where the error number
doesn't reflect the out of memory condition but the message does?

Cheers,
Adam.

      reply	other threads:[~2014-02-23 19:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-23 18:41 Chris Brannon
2014-02-23 19:38 ` Adam Thompson [this message]

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=20140223193844.GD15819@toaster.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=chris@the-brannons.com \
    --cc=edbrowse-dev@lists.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).