php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28396 crash when memory limit reached
Submitted: 2004-05-14 13:23 UTC Modified: 2004-05-14 17:08 UTC
Votes:11
Avg. Score:5.0 ± 0.0
Reproduced:8 of 9 (88.9%)
Same Version:3 (37.5%)
Same OS:3 (37.5%)
From: operator at infomaniak dot ch Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.6 OS: linux glibc 2.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: operator at infomaniak dot ch
New email:
PHP Version: OS:

 

 [2004-05-14 13:23 UTC] operator at infomaniak dot ch
Description:
------------
When memory limit is reached, this irremdiably cause a 
segfault. 
-- 
php with no extensions at all compiled with: 
    --disable-all \ 
    --with-apxs=/usr/sbin/apxs \ 
    --enable-sigchild \ 
    --disable-ipv6 \ 
    --enable-memory-limit \ 
    --with-config-file-path=/etc/httpd \ 
    --disable-static \ 
    --enable-shared \ 
    --enable-debug 
 
reproductible with any memory_limit value (tried from 512 
bytes to 8M) 

Reproduce code:
---------------
<?
$i=1;
while($i++) {
        $a .= ".";
        if (($i % 1024) == 0) {
                echo memory_get_usage() . "<br/>\n";
                flush();
        }
}
?>


Expected result:
----------------
some kind of "memory exhausted" message 

Actual result:
--------------
apache thread segfault 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-14 13:46 UTC] wez@php.net
This is expected behaviour; in a debug build, when memory allocation fails, we force a segfault.

Don't run debug builds in production.
 [2004-05-14 14:05 UTC] operator at infomaniak dot ch
Alright. This is not true. 
Memory allocation failing due to external bad behaviour 
must cause segfault, not because of memory_limit reached. 
 
Then, I get exactly the same result without 
--enable-debug . 
 
For info, crash occurs exactly when memory_limit is 
reached. 
 
(output just before crash: 
509528 
510552 
511576 
with a memory limit at 512000 
output got without --enable-debug) 
)
 [2004-05-14 15:33 UTC] iliaa@php.net
No crashes here and memory analysis tools show no 
suspicious operations. 
 [2004-05-14 16:41 UTC] operator at infomaniak dot ch
Have you really tried to put this script and run it 
with a php_admin_value memory_limit 512000  
?
 [2004-05-14 17:05 UTC] operator at infomaniak dot ch
Finaly, this won't segfault, you were right. 
Then, it appears that in some rare conditions, just after 
memory_limit reached, segfault comes. 
But, this may be because of any other extension. 
 
For this, could you tell how to compile seperate 
extensions 
(ala phpize etc...) with debug enabled ? 
with a core compiled with --enable-debug, extensions still 
get build without debug...
 [2004-05-14 17:08 UTC] iliaa@php.net
yes 
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Feb 06 02:00:01 2026 UTC