Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55590 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94053 invoked from network); 22 Sep 2011 20:34:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2011 20:34:30 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.218.42 mail-yi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:49080] helo=mail-yi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/92-11679-3DB9B7E4 for ; Thu, 22 Sep 2011 16:34:27 -0400 Received: by yib12 with SMTP id 12so2672078yib.29 for ; Thu, 22 Sep 2011 13:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Op6hB/KRyjTM/ba4O69NJpffbv/bJmBm6PETrE/zCU4=; b=IaTipOK0s439iP1BcakO+BMRYFeR8xGpZr07reKJyBFHxwRUZFsE7HDHTrFSJkWKL0 MxCcqVVwtZQfUrpCIDkXZTJxa+G0Fd4STILd5+q7Vi8JKUjgOhhlAqFPUGfln7/tDI3A rNzXOUl9i1U5U+DOpJPEC0tArElR5Ti9rocSg= MIME-Version: 1.0 Received: by 10.146.93.33 with SMTP id q33mr2557482yab.13.1316723664184; Thu, 22 Sep 2011 13:34:24 -0700 (PDT) Received: by 10.147.125.13 with HTTP; Thu, 22 Sep 2011 13:34:24 -0700 (PDT) Date: Thu, 22 Sep 2011 22:34:24 +0200 Message-ID: To: Christopher Jones Cc: Dmitry Stogov , Laruence , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/tests/bug55509.phpt branches/PHP_5_3/Zend/zend_alloc.c branches/PHP_5_4/Zend/tests/bug55509.phpt branches/PHP_5_4/Zend/zend_alloc.c trunk/Zend/tests/bug55509.phpt trunk/Zend From: tyra3l@gmail.com (Ferenc Kovacs) I just stumbled upon on this test as it timed out for me(my test vm started swapping, so run-tests.php terminated after 60 sec). I think it would be good if we could somehow check the available ram, and skipif if it isn't enough, and I think we could also save off an str_repeat call: each str_repeat call allocates 512M of ram, so the 5th call will never happen when the bug is present, as it would allocate a little more than 2.5G ram. the test could be modified having a memory limit of 2100M and removing the sixth str_repeat call and the line '5' from the expect output. btw: what do you think about adding a memory_get_available() function: http://stackoverflow.com/questions/2513505/how-to-get-available-memory-c-g/= 2513561#2513561 On Tue, Sep 13, 2011 at 8:17 PM, Christopher Jones wrote: > > Dmitry, > > This is diffing for me in 5.4 (I've haven't looked at 5.3 or trunk): > > 007+ Fatal error: Allowed memory size of 3221225472 bytes exhausted at > /home/cjones/phpsrc/php/php-src/branches/PHP_5_4/ext/standard/string.c:46= 36 > (tried to allocate 536870913 bytes) in > /home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/tests/bug55509.php = on > line 12 > 007- Fatal error: Allowed memory size of %d bytes exhausted (tried to > allocate %d bytes) in %s/bug55509.php on line %d > > Chris > > On 09/13/2011 12:01 AM, Dmitry Stogov wrote: >> >> dmitry =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Tue, 13 Sep 2011 07= :01:46 +0000 >> >> Revision: http://svn.php.net/viewvc?view=3Drevision&revision=3D316590 >> >> Log: >> Fixed bug #55509 (segfault on x86_64 using more than 2G memory). >> (Laruence) >> >> Bug: https://bugs.php.net/55509 (Verified) segfault on x86_64 using more >> than 2G memory >> >> Changed paths: >> =C2=A0 =C2=A0 U =C2=A0 php/php-src/branches/PHP_5_3/NEWS >> =C2=A0 =C2=A0 A =C2=A0 php/php-src/branches/PHP_5_3/Zend/tests/bug55509.= phpt >> =C2=A0 =C2=A0 U =C2=A0 php/php-src/branches/PHP_5_3/Zend/zend_alloc.c >> =C2=A0 =C2=A0 A =C2=A0 php/php-src/branches/PHP_5_4/Zend/tests/bug55509.= phpt >> =C2=A0 =C2=A0 U =C2=A0 php/php-src/branches/PHP_5_4/Zend/zend_alloc.c >> =C2=A0 =C2=A0 A =C2=A0 php/php-src/trunk/Zend/tests/bug55509.phpt >> =C2=A0 =C2=A0 U =C2=A0 php/php-src/trunk/Zend/zend_alloc.c >> >> Modified: php/php-src/branches/PHP_5_3/NEWS >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_3/NEWS =C2=A0 2011-09-13 06:22:25 UTC (re= v >> 316589) >> +++ php/php-src/branches/PHP_5_3/NEWS =C2=A0 2011-09-13 07:01:46 UTC (re= v >> 316590) >> @@ -8,6 +8,7 @@ >> =C2=A0 =C2=A0. Fixed bug #55366: keys lost when using substr_replace an = array. >> (Arpad) >> =C2=A0 =C2=A0. Fixed bug #55510: $_FILES 'name' missing first character = after >> upload. >> =C2=A0 =C2=A0 =C2=A0(Arpad) >> + =C2=A0. Fixed bug #55509 (segfault on x86_64 using more than 2G memory= ). >> (Laruence) >> =C2=A0 =C2=A0. Fixed bug #55576: Cannot conditionally move uploaded file= without >> race >> =C2=A0 =C2=A0 =C2=A0condition. (Gustavo) >> =C2=A0 =C2=A0. Fixed bug #55504 (Content-Type header is not parsed corre= ctly on >> >> Added: php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (rev 0) >> +++ php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt =C2=A0 =C2=A0 = =C2=A0 2011-09-13 >> 07:01:46 UTC (rev 316590) >> @@ -0,0 +1,33 @@ >> +--TEST-- >> +Bug #55509 (segfault on x86_64 using more than 2G memory) >> +--SKIPIF-- >> +> +if (PHP_INT_SIZE =3D=3D 4) { >> + =C2=A0die('skip Not for 32-bits OS'); >> +} >> +?> >> +--INI-- >> +memory_limit=3D3G >> +--FILE-- >> +> +$a1 =3D str_repeat("1", 1024 * 1024 * 1024 * 0.5); >> +echo "1\n"; >> +$a2 =3D str_repeat("2", 1024 * 1024 * 1024 * 0.5); >> +echo "2\n"; >> +$a3 =3D str_repeat("3", 1024 * 1024 * 1024 * 0.5); >> +echo "3\n"; >> +$a4 =3D str_repeat("4", 1024 * 1024 * 1024 * 0.5); >> +echo "4\n"; >> +$a5 =3D str_repeat("5", 1024 * 1024 * 1024 * 0.5); >> +echo "5\n"; >> +$a6 =3D str_repeat("6", 1024 * 1024 * 1024 * 0.5); >> +echo "6\n"; >> +?> >> +--EXPECTF-- >> +1 >> +2 >> +3 >> +4 >> +5 >> + >> +Fatal error: Allowed memory size of %d bytes exhausted (tried to alloca= te >> %d bytes) in %s/bug55509.php on line %d >> >> Modified: php/php-src/branches/PHP_5_3/Zend/zend_alloc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_3/Zend/zend_alloc.c =C2=A0 =C2=A0 =C2=A02= 011-09-13 >> 06:22:25 UTC (rev 316589) >> +++ php/php-src/branches/PHP_5_3/Zend/zend_alloc.c =C2=A0 =C2=A0 =C2=A02= 011-09-13 >> 07:01:46 UTC (rev 316590) >> @@ -510,7 +510,7 @@ >> =C2=A0#define ZEND_MM_IS_GUARD_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (((b)->info._size& >> =C2=A0ZEND_MM_TYPE_MASK) =3D=3D ZEND_MM_GUARD_BLOCK) >> >> =C2=A0#define ZEND_MM_NEXT_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ZEND_MM_BLOCK_AT(b, >> ZEND_MM_BLOCK_SIZE(b)) >> -#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(int)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> +#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(ssize_t)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> >> =C2=A0#define ZEND_MM_PREV_BLOCK_IS_FREE(b) (!((b)->info._prev& >> =C2=A0ZEND_MM_USED_BLOCK)) >> >> >> Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (rev 0) >> +++ php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt =C2=A0 =C2=A0 = =C2=A0 2011-09-13 >> 07:01:46 UTC (rev 316590) >> @@ -0,0 +1,33 @@ >> +--TEST-- >> +Bug #55509 (segfault on x86_64 using more than 2G memory) >> +--SKIPIF-- >> +> +if (PHP_INT_SIZE =3D=3D 4) { >> + =C2=A0die('skip Not for 32-bits OS'); >> +} >> +?> >> +--INI-- >> +memory_limit=3D3G >> +--FILE-- >> +> +$a1 =3D str_repeat("1", 1024 * 1024 * 1024 * 0.5); >> +echo "1\n"; >> +$a2 =3D str_repeat("2", 1024 * 1024 * 1024 * 0.5); >> +echo "2\n"; >> +$a3 =3D str_repeat("3", 1024 * 1024 * 1024 * 0.5); >> +echo "3\n"; >> +$a4 =3D str_repeat("4", 1024 * 1024 * 1024 * 0.5); >> +echo "4\n"; >> +$a5 =3D str_repeat("5", 1024 * 1024 * 1024 * 0.5); >> +echo "5\n"; >> +$a6 =3D str_repeat("6", 1024 * 1024 * 1024 * 0.5); >> +echo "6\n"; >> +?> >> +--EXPECTF-- >> +1 >> +2 >> +3 >> +4 >> +5 >> + >> +Fatal error: Allowed memory size of %d bytes exhausted (tried to alloca= te >> %d bytes) in %s/bug55509.php on line %d >> >> Modified: php/php-src/branches/PHP_5_4/Zend/zend_alloc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_4/Zend/zend_alloc.c =C2=A0 =C2=A0 =C2=A02= 011-09-13 >> 06:22:25 UTC (rev 316589) >> +++ php/php-src/branches/PHP_5_4/Zend/zend_alloc.c =C2=A0 =C2=A0 =C2=A02= 011-09-13 >> 07:01:46 UTC (rev 316590) >> @@ -515,7 +515,7 @@ >> =C2=A0#define ZEND_MM_IS_GUARD_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (((b)->info._size& >> =C2=A0ZEND_MM_TYPE_MASK) =3D=3D ZEND_MM_GUARD_BLOCK) >> >> =C2=A0#define ZEND_MM_NEXT_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ZEND_MM_BLOCK_AT(b, >> ZEND_MM_BLOCK_SIZE(b)) >> -#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(int)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> +#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(ssize_t)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> >> =C2=A0#define ZEND_MM_PREV_BLOCK_IS_FREE(b) (!((b)->info._prev& >> =C2=A0ZEND_MM_USED_BLOCK)) >> >> >> Added: php/php-src/trunk/Zend/tests/bug55509.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/trunk/Zend/tests/bug55509.phpt >> =C2=A0(rev 0) >> +++ php/php-src/trunk/Zend/tests/bug55509.phpt =C2=A02011-09-13 07:01:46= UTC >> (rev 316590) >> @@ -0,0 +1,33 @@ >> +--TEST-- >> +Bug #55509 (segfault on x86_64 using more than 2G memory) >> +--SKIPIF-- >> +> +if (PHP_INT_SIZE =3D=3D 4) { >> + =C2=A0die('skip Not for 32-bits OS'); >> +} >> +?> >> +--INI-- >> +memory_limit=3D3G >> +--FILE-- >> +> +$a1 =3D str_repeat("1", 1024 * 1024 * 1024 * 0.5); >> +echo "1\n"; >> +$a2 =3D str_repeat("2", 1024 * 1024 * 1024 * 0.5); >> +echo "2\n"; >> +$a3 =3D str_repeat("3", 1024 * 1024 * 1024 * 0.5); >> +echo "3\n"; >> +$a4 =3D str_repeat("4", 1024 * 1024 * 1024 * 0.5); >> +echo "4\n"; >> +$a5 =3D str_repeat("5", 1024 * 1024 * 1024 * 0.5); >> +echo "5\n"; >> +$a6 =3D str_repeat("6", 1024 * 1024 * 1024 * 0.5); >> +echo "6\n"; >> +?> >> +--EXPECTF-- >> +1 >> +2 >> +3 >> +4 >> +5 >> + >> +Fatal error: Allowed memory size of %d bytes exhausted (tried to alloca= te >> %d bytes) in %s/bug55509.php on line %d >> >> Modified: php/php-src/trunk/Zend/zend_alloc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/trunk/Zend/zend_alloc.c 2011-09-13 06:22:25 UTC (rev >> 316589) >> +++ php/php-src/trunk/Zend/zend_alloc.c 2011-09-13 07:01:46 UTC (rev >> 316590) >> @@ -515,7 +515,7 @@ >> =C2=A0#define ZEND_MM_IS_GUARD_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (((b)->info._size& >> =C2=A0ZEND_MM_TYPE_MASK) =3D=3D ZEND_MM_GUARD_BLOCK) >> >> =C2=A0#define ZEND_MM_NEXT_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 ZEND_MM_BLOCK_AT(b, >> ZEND_MM_BLOCK_SIZE(b)) >> -#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(int)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> +#define ZEND_MM_PREV_BLOCK(b) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0ZEND_MM_BLOCK_AT(b, >> -(ssize_t)((b)->info._prev& =C2=A0~ZEND_MM_TYPE_MASK)) >> >> =C2=A0#define ZEND_MM_PREV_BLOCK_IS_FREE(b) (!((b)->info._prev& >> =C2=A0ZEND_MM_USED_BLOCK)) >> >> >> >> >> > > -- > Email: christopher.jones@oracle.com > Tel: =C2=A0+1 650 506 8630 > Blog: =C2=A0http://blogs.oracle.com/opal/ > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu