From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [IPv6:2a00:1450:400c:c00::22c]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 7654E7842A for ; Fri, 7 Feb 2014 06:26:49 -0800 (PST) Received: by mail-wg0-f44.google.com with SMTP id l18so2278480wgh.23 for ; Fri, 07 Feb 2014 06:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=NevHwHowvhP0vgd5EikUfu3WYDtE5p6B2xm+QmQPkmA=; b=qpxfL5GZ1S7L7Q4VMoRAx8I/o443GTvJ27BzV8NsFtiaszjOOgkYy8PkAHJUvDp+oC aMZCdF0jYcxx5NmMkpV/QpAVtdtntgdz4XK0e+DtyHwZzBh5hfZq4UcL0WR1eCc+wkPx AWknH3+wD3e28kZsQa8wr3561LNcD8qx1aUWDBtLRzP7wNJz2X7g14u58YFq2pVzjUcG 2x4LZtbQjALnjaIZM/1YWpqw6suLVaMGM7skuAy6S9Ww5tReF/xrzJLi28gPnkNF+626 Ypd7rylVBtAb00DKkrsKg4Yj/DdmYyAwauo/KGW5VtGjxPooNL/7hi3EKE5QJLGet/Oa vwbQ== X-Received: by 10.180.36.8 with SMTP id m8mr103938wij.42.1391783172254; Fri, 07 Feb 2014 06:26:12 -0800 (PST) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id t6sm8664823wix.4.2014.02.07.06.26.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 07 Feb 2014 06:26:11 -0800 (PST) Date: Fri, 7 Feb 2014 14:26:02 +0000 From: Adam Thompson To: Chris Brannon Message-ID: <20140207142602.GA29314@toaster.adamthompson.me.uk> References: <20140107013051.eklhad@comcast.net> <874n4bgj6f.fsf@mushroom.PK5001Z> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874n4bgj6f.fsf@mushroom.PK5001Z> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] suggest increasing the size argument to JS_NewRuntime X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 14:26:49 -0000 On Fri, Feb 07, 2014 at 05:13:12AM -0800, Chris Brannon wrote: > Karl Dahlke 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.