[PHP-BUG] Bug #51420 [NEW]: Silent crash when memory usage >= 4MByte

[email protected] ("pst at telia dot com") Mon, 29 Mar 2010 00:44:06 +0200 (CEST)
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Windows Server 2003 SP2
PHP version:      5.3.2
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Silent crash when memory usage >= 4MByte

Description:
------------
Hi,

I get a silent crash when I add data to an array. I access a com object and
an oracle database in the script but not while it crashes.

memory_get_usage(true) shows 3932160 bytes before script crashes.

Windows Task Manager shows php.exe mem usage building up to a maximum of
around 42,100 K when it crashes.

phpinfo() shows memory_limit => 256M => 256M

I use php.exe (VC6 thread safe) but get the same crash using php-win.exe or
via apache 2.2 module.

The script crashes on 5.3.0 as well but works on an older system using php
4.3.4 & Windows Server 2000 SP4.



Test script:
---------------
Can't provide entire script and include files but this is what I do when it
crashes:

         for ($i=0;$i<20000;$i++) {
            print "$i ";
            $arr[$i][0]='2010-03-29 00:00:'+$i%100;
            $arr[$i][1]=rand(1,100);
            print memory_get_usage(true);
            print "\r\n";
            usleep(10);
         }
         print "ok";



Expected result:
----------------
I expect the script to loop 20000 times and finish by writing "ok".


Actual result:
--------------
End of the output is:

9990 3932160
9991 3932160
9992 3932160
9993 3932160
9994 

So it crashes on one of the lines where array data is added.



Backtrace:

Thread 0 - System ID 5760
Entry point   php+2d78 
Create time   3/29/2010 12:23:21 AM 
Time spent in user mode   0 Days 0:0:0.15 
Time spent in kernel mode   0 Days 0:0:0.93 


Function     Arg 1     Arg 2     Arg 3   Source 
php5ts!zobj_mark_grey+51     01b42eac     00c0fb14     00222718    
php5ts!gc_mark_roots+76     00222718     00222718     01c6ac18    
php5ts!gc_collect_cycles+64     00222718     057c820c     01b80e78    
php5ts!gc_zval_possible_root+df     057c8190     00222718     00000000    
php5ts!ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER+72     00c0fc0c     00222718 
   00c0fea8    
php5ts!execute+2fe     01b80e78     00222700     00000000    
php5ts!zend_execute_scripts+f6     00000008     00222718     00000000    
php5ts!php_execute_script+245     00c0fea8     00222718     00000000    
php+1ec1     00000002     00223fc8     00222ba8    
php+2e5b     00000000     00000000     7ffdb000    
kernel32!ProcessIdToSessionId+209     00402d78     00000000     00000000   





PHP5TS!ZOBJ_MARK_GREY+51In
php__PID__6396__Date__03_29_2010__Time_12_25_58AM__869__Second_Chance_Exception_C0000005.dmp
the assembly instruction at php5ts!zobj_mark_grey+51 in C:\Program
Files\PHP\php5ts.dll from The PHP Group has caused an access violation
exception (0xC0000005) when trying to read from memory location 0x00000014
on thread 0



-- 
Edit bug report at http://bugs.php.net/bug.php?id=51420&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51420&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51420&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51420&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51420&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51420&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51420&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51420&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51420&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51420&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51420&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51420&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51420&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51420&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51420&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51420&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51420&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51420&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51420&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51420&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51420&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51420&r=mysqlcfg