ID: 40222 User updated by: tdondich at groundworkopensource dot com Reported By: tdondich at groundworkopensource dot com -Status: Feedback +Status: Open Bug Type: Apache2 related Operating System: Ubuntu Edgy PHP Version: 5.2.0 New Comment:
PHP Version 5.2.1RC4-dev, php5.2-200701241730 Corrects the issue. 2 things: 1) Can we know what was the cause of the issue in case we need to do a work around? 2) When is PHP 5.2.1 scheduled to be released? Previous Comments: ------------------------------------------------------------------------ [2007-01-24 18:43:37] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip ------------------------------------------------------------------------ [2007-01-24 18:42:09] tdondich at groundworkopensource dot com Description: ------------ Using: - Apache 2.2.4 - PHP 5.2.0 w/ sessions Description: When running this simple script, Apache2 will consume all available memory and the script will not complete (with no memory limit and high time limit) until all memory is taken by Apache 2 process and system starts to fail (swap extensively until nothing is responsive). Reproduce code: --------------- <?php session_start(); $myarray = array(); $numOfIterations = 100000; // Set to 10000 to see the script succeed for($counter = 0; $counter < $numOfIterations; $counter++) { $myarray[$counter] = 'jkdfjklsdfjklfsdhjklsdfhildfnifsdnsdfnlfsdnklfsdnkglgfnkl;nmklsdf'; } // copy the array, just for kicks $_SESSION['test'] = $myarray; sleep(5); // See the memory usage in top for awhile print("Completed."); ?> Expected result: ---------------- Apache2 process (pre-fork) will consume all available memory and continue to climb until system swaps excessively and then becomes unresponsive. Changing the $numOfIterations to 10000 causes it to succeed. By my account, the memory needed approx for each array is: 100000 X 66 = 6600000bytes 6600000 / 1048576 = 6 megabytes Even when copying it to $_SESSION, it should only take 12 megs, plus maybe a little more for overhead (array constructs, program execution). We're seeing consumption of over a gigabyte and growing with one script execution. Actual result: -------------- TAKEN FROM TOP: Mem: 1035632k total, 1021568k used, 14064k free, 1208k buffers Swap: 3028212k total, 432996k used, 2595216k free, 40336k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 16094 tdondich 16 0 344m 86m 5172 S 1 8.6 15:16.51 java 4205 root 15 0 197m 19m 3960 S 1 1.9 31:37.61 Xorg 28209 daemon 18 0 779m 704m 2148 D 1 69.7 0:04.34 httpd No other pages being served on this box. The script was continuing to execute at this time. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40222&edit=1