php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26665 php crashes with large files and array work (2MB Script File). win32 works.
Submitted: 2003-12-19 04:36 UTC Modified: 2004-02-10 09:10 UTC
Votes:5
Avg. Score:4.0 ± 1.5
Reproduced:4 of 5 (80.0%)
Same Version:2 (50.0%)
Same OS:4 (100.0%)
From: fschaper at intux dot org Assigned:
Status: Wont fix Package: Reproducible crash
PHP Version: 4CVS, 5CVS OS: *
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
42 - 26 = ?
Subscribe to this entry?

 
 [2003-12-19 04:36 UTC] fschaper at intux dot org
Description:
------------
While working with "many" array's (around 2MB of code) we encountered a crash on linux-systems while everything works fine under windows. PHP silently fails - only error log is the apache segfault.

Apache 1.3.28
PHP 4.3.3


Reproduce code:
---------------
http://www.intux.org/tmp/php_segf_test.tar.gz

100 Lines of code works
Around 103 lines and more and it starts to break down

Expected result:
----------------
The last PHP command should write an "done" on the page. 

Actual result:
--------------
An empty document should be returned since apache simply crashes

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-19 09:59 UTC] fschaper at intux dot org
This time I ran the script via the shell without apache

(gdb) bt
#0  0x0811f8f6 in execute (op_array=0x819841c)
    at /usr/src/debug/php4-STABLE-200312191430/Zend/zend_execute.c:1758
#1  0x0810fa28 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/src/debug/php4-STABLE-200312191430/Zend/zend.c:884
#2  0x080ed1d3 in php_execute_script (primary_file=0xbffffcf8)
    at /usr/src/debug/php4-STABLE-200312191430/main/main.c:1729
#3  0x08125eb3 in main (argc=2, argv=0xbffffd74)
    at /usr/src/debug/php4-STABLE-200312191430/sapi/cgi/cgi_main.c:1578
(gdb) frame 0
#0  0x0811f8f6 in execute (op_array=0x819841c)
    at /usr/src/debug/php4-STABLE-200312191430/Zend/zend_execute.c:1758
1758                                            ALLOC_ZVAL(valptr);
 [2003-12-22 07:59 UTC] fschaper at intux dot org
This Bug can be repoduduced under Window's as well, only the file-size has to be larger (will depend on system memory etc.). I have tried it with an 8MB version (might as well take less than that) of the script (the one I added the link to) and PHP crashes under Windows as well.
 [2003-12-30 10:26 UTC] sniper@php.net
Does not crash for me. And the example script is pretty useless anyway, you really should be using error_reporting = E_ALL once..

 [2004-02-05 16:34 UTC] brianlmoon@php.net
I can reproduce this at will.  It is not a memory issue as I can create the array in code with ease and not crash.  I can also split the file into several files and all is ok.  It is only when I try to load a large file (~2.8MB for me) that PHP crashes.  I provide the following test file that is 4MB+ that crashes every time.

http://spidey.dealnews.com/~brianm/php_large_file_crash.php.txt

As you will see, I have an early call to exit() in that file.  That nor the echo ever happens.  I ran this with and without my custom php.ini file.

My PHP version info:

$ php -v
PHP 4.3.4 (cli) (built: Feb  5 2004 16:00:45) (DEBUG)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

gdb did not give me much:

(gdb) run
Starting program: /usr/local/bin/php php_large_file_crash.php.txt

Program received signal SIGSEGV, Segmentation fault.
execute (op_array=0x8221834) at /usr/src/apache/php-4.3.4/Zend/zend_execute.c:1071
1071                    zend_clean_garbage(TSRMLS_C);

We generate large amounts of cached arrays in files.  This is the first time this has happened as far as I know.
 [2004-02-05 20:35 UTC] pajoye@php.net
Hello,

PHP ""should"" not crash in this case. However I missed your conception of a cache. I suggest you to look at a database, ie sqlite. I hope you do not use this kind of """cache""" too much.

pierre
 [2004-02-06 10:54 UTC] sniper@php.net
You're hitting the max number of array elements. 
This is 'fixed' in PHP5 where there can be more elements in an array. It has nothing to do with the file size.


 [2004-02-10 09:10 UTC] fschaper at intux dot org
When I disable max. stacksize via
ulimit -HSs unlimited
everything works out fine (CLI) - run's in ca. 2s on my machine. That does not affect apache however (ca. 1m) .. but this should not be an PHP issue I guess.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 21:01:27 2024 UTC