php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51420 Silent crash when memory usage >= 4MByte
Submitted: 2010-03-29 00:43 UTC Modified: 2013-02-18 00:34 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: pst at telia dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.3.2 OS: Windows Server 2003 SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-03-29 00:43 UTC] pst at telia dot com
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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-29 01:04 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-29 01:04 UTC] pajoye@php.net
I can't reproduce the crash, this script works just fine.

Do you use 5.3.2 or 5.3? Using CLI or inside a webserver?
 [2010-03-29 01:32 UTC] pst at telia dot com
-Status: Feedback +Status: Open
 [2010-03-29 01:32 UTC] pst at telia dot com
The script is just a snippet of the entire script. Unfortunately I can't provide the entire script and include files.

I use 5.3.2 CLI (php.exe) but I used 5.3.0 before and it crashes too.

If I call the script from inside the webserver (PHP5.3.2 & apache 2.2.15) I still get the same crash.


My wild guess is that there is some kind of problem inside the memory allocation as the crash is just when a new block (256kB) is about to be allocated. 

It is likely related to something else being allocated as well because I can't reproduce that crash by just using the little code snippet above.
 [2010-03-29 01:40 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-29 01:40 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2010-03-29 01:55 UTC] pst at telia dot com
-Status: Feedback +Status: Open
 [2010-03-29 01:55 UTC] pst at telia dot com
The problem is that the original script accesses a huge Oracle 11G database and uses COM automation that in turn gets data from a different kind of server on the network. So there is simply no way you could run the same script I do.

But I'll try and see if I can make a simpler script to reproduce the error.

Right now I'm installing 5.2.13 to see if it behaves the same way.
 [2010-03-29 02:50 UTC] pst at telia dot com
Update:

5.2.13 works fine with the exact same script that crashes every time on 5.3.0 and 5.3.2.


Also:

It looks like my problem may have some similarities to this one:
http://bugs.php.net/bug.php?id=49700
 [2010-03-29 02:55 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-29 02:55 UTC] pajoye@php.net
It looks different, but similar location for the crash.

Please reopen when you have a script to reproduce it.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 13:05:53 2022 UTC