Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77803 invoked from network); 14 Jun 2013 18:47:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2013 18:47:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.54 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.212.54 mail-vb0-f54.google.com Received: from [209.85.212.54] ([209.85.212.54:37492] helo=mail-vb0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/7B-32590-E456BB15 for ; Fri, 14 Jun 2013 14:47:42 -0400 Received: by mail-vb0-f54.google.com with SMTP id q12so695171vbe.27 for ; Fri, 14 Jun 2013 11:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EyUMbIcRzvWp1IkXL2K8qvErmswT1d+dxe4JPqhkOJ0=; b=c2rta2pj+SYziESe6ecD6wBy/FCz28T3lUmNAod/2YSZ6++mvu4yPY7/pE3cqpWJmY WMUBA+JGXPJ8aUcEzgUjWva/IV+V08nOPa9D4l7WK3S8hO3q0rqkBUdRby8uIkNIsLKR 5lEs8GAtMWDQwppyeVjxeF+EkRSzct6crz4O/X7D34JMvxwwiwfZ/LnJSF5qcgroTRGN 09OAP6CuqPGsMkkKVsec9SWIiIVbBMG4KR6Z1fEOtxqA5MHzBMz2luPMrRd7Rt/d5zZ7 dbenXqnsqX2GQCx3l1cxwZw+fsY40vPSqrCr798oQI9AbVIYuFFy8Lg4LPJUJIVnMRB0 PsTg== MIME-Version: 1.0 X-Received: by 10.58.32.138 with SMTP id j10mr385671vei.64.1371235658966; Fri, 14 Jun 2013 11:47:38 -0700 (PDT) Received: by 10.58.199.76 with HTTP; Fri, 14 Jun 2013 11:47:38 -0700 (PDT) In-Reply-To: <51BB6287.1020200@lerdorf.com> References: <51BB6287.1020200@lerdorf.com> Date: Fri, 14 Jun 2013 14:47:38 -0400 Message-ID: To: Rasmus Lerdorf Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b417e195b2f6204df21ae3f Subject: Re: [PHP-DEV] Zend GC Recursion Elimination From: ircmaxell@gmail.com (Anthony Ferrara) --047d7b417e195b2f6204df21ae3f Content-Type: text/plain; charset=ISO-8859-1 Rasmus, On Fri, Jun 14, 2013 at 2:35 PM, Rasmus Lerdorf wrote: > On 06/14/2013 11:04 AM, Anthony Ferrara wrote: > > When you run that on current master, you get a segfault stemming from the > > zval_mark_grey() GC function. > > This segfault, or at least a segfault in zval_mark_grey(), has been > reported a couple of times: > > https://bugs.php.net/64868 > https://bugs.php.net/64827 > https://bugs.php.net/61968 A quick look at those bugs appears to be a different cause. The backtrace is VERY different from the segfault I got: #0 0x0000000000587122 in zval_mark_grey (pz=0x7ffff1a7ce38) at /home/ircmaxell/php-src2/Zend/zend_gc.c:374 #1 0x0000000000587255 in zval_mark_grey (pz=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:432 #2 0x0000000000587255 in zval_mark_grey (pz=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:432 #3 0x0000000000587255 in zval_mark_grey (pz=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:432 **SNIP** #196320 0x0000000000587255 in zval_mark_grey (pz=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:432 #196321 0x0000000000587255 in zval_mark_grey (pz=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:432 #196322 0x0000000000588105 in gc_mark_roots () at /home/ircmaxell/php-src2/Zend/zend_gc.c:501 #196323 gc_collect_cycles () at /home/ircmaxell/php-src2/Zend/zend_gc.c:795 #196324 0x0000000000588359 in gc_zval_possible_root (zv=) at /home/ircmaxell/php-src2/Zend/zend_gc.c:166 ... So this is due to DEEP recursion (but not infinite) in zval_mark_grey, where those 3 bugs (at least the two with backtraces) appear to be more illegal memory access as opposed to unbound recursion... At least on the surface... > > So not a huge win overall, but can be significant in cases... > > > > What do you think? Is this worth pursuing further? is there a case I'm > > missing, or some other reason we shouldn't do this? > > Since the reduced stack usage is likely to reduce the chances of hitting > this segfault, which if it is the same one as in the bug reports, it is > happening in the wild, then it is very much worthwhile to pursue this. > > Well, again, this segfault is an extreme edge-case. I'm not sure if it will work, but I will tag into one of those tickets, and see if this refactor does indeed clean it up (or not)... Thanks Anthony --047d7b417e195b2f6204df21ae3f--