From: Adam Thompson <arthompson1990@gmail.com>
To: Chris Brannon <chris@the-brannons.com>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] segfault with small pool
Date: Wed, 19 Feb 2014 21:04:28 +0000 [thread overview]
Message-ID: <20140219210428.GM28870@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <877g8r6m75.fsf@mushroom.PK5001Z>
On Wed, Feb 19, 2014 at 09:34:22AM -0800, Chris Brannon wrote:
> Adam Thompson <arthompson1990@gmail.com> writes:
>
> > I'm not sure if that's even possible at the moment given the way some of the
> > functions work. I'd hope that what happens when we destroy the context is that
> > the context-linked roots also go away (which'd make sense).
>
> They don't go away. I just verified that with gdb.
Ugh, that's actually really annoying.
> I'm starting to see a possible fix, I think.
> In javaSessionFail, do not call freeJavaContext at all.
> Add a new variable to cw: cw->jss_saved.
> Now javaSessionFail looks like this:
> cw->jss_saved = cw->jss;
> cw->jss = NULL;
>
> Now we have two cases to consider.
> 1. Spidermonkey ran out of memory while parsing the page, or
> 2. Spidermonkey ran out of memory when handling a JS event like onclick.
>
> For case 1, when we've finished parsing the page,
> call freeJavaContext(cw->jss_saved) if cw->jss_saved is not NULL.
> Set cw->jss_saved to NULL so we don't double-free.
> I think we can do this at the end of parsePage. There will be no
> stack-allocated JS roots at this point.
Yep, or set a flag in cw like js_failed and leave jss as non-null,
adding the relevant checks.
>
> It's going to be a lot messier for case 2, I think. Can we just do the
> "free-if-saved" check after each call to handlerGo?
Probably.
>
> BTW, freeJavaContext also has a bug.
Yep, I pushed a fix for this one earlier today.
Cheers,
Adam.
next prev parent reply other threads:[~2014-02-19 21:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 9:21 Karl Dahlke
2014-02-19 11:28 ` Adam Thompson
2014-02-19 11:38 ` Adam Thompson
2014-02-19 14:12 ` Adam Thompson
2014-02-19 16:07 ` Chris Brannon
2014-02-19 16:52 ` Adam Thompson
2014-02-19 17:34 ` Chris Brannon
2014-02-19 21:04 ` Adam Thompson [this message]
2014-02-19 16:36 Karl Dahlke
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=20140219210428.GM28870@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).