ID: 13806 Updated by: zeev Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Reproducible crash Operating System: Linux 2.4.14-pre3/glibc 2.2.2 PHP Version: 4.1.0 RC CVS-2001-10-24 New Comment:
This issue does not appear to be related in any way to the bug id's 12270 and 13698... Previous Comments: ------------------------------------------------------------------------ [2001-11-10 11:07:11] [EMAIL PROTECTED] This is most probably not a bug, at least not in the way you perceive it. With a large output buffer - the script will indeed have to consume lots of memory. If your memory limit does not allow this - you'll get these warnings, and in case of a debug build - those complaints about memory being freed... Now, there could be two authentic bugs: (a) There may be a bug in the memory limit implementation. However, it's the same as it has been for years, and it may be that just output buffering is exploiting it in a way that wasn't thought of before. Generally, if the memory limit is reached, PHP tries to bail out nicely. If somehow, PHP goes on consuming more memory, beyond 1MB above the memory limit - it performs a hard exit(). It's possible that the shutdown sequence causes some loop of memory exhaustion - bailout - memory exhaustion - bailout#2 - etc., which cannot be broken. I'll take a look at it. (b) There might be a memory leak in the zlib output compression code. Please let me know what buffer size you use. You really shouldn't be using more than about 16KB or so. ------------------------------------------------------------------------ [2001-10-28 10:28:34] [EMAIL PROTECTED] Problem is appearent if output is larger than output buffer size. httpd exits with code 01 with following script (No output) <?php for ($i=0; $i < 1024; $i++) echo 'abcd'; ?> but it not with (Output is correct) <?php for ($i=0; $i < 1023; $i++) echo 'abcd'; ?> It exits with code 01 with more complex script w/o output, though. ------------------------------------------------------------------------ [2001-10-28 08:50:56] [EMAIL PROTECTED] Upgraded from apache 1.3.20 to 1.3.22. httpd exited with status code 01 while running under gdb. (gdb) run -X Starting program: /usr/sbin/httpd -X Program exited with code 01. (gdb) ------------------------------------------------------------------------ [2001-10-28 07:29:53] [EMAIL PROTECTED] via-rihine chipset NIC dvriver seems to be fixed in 2.4.13, finanlly :) I could upgrade kernel from 2.4.4 to 2.4.14-pre3. It seems many *.c files are not modified for new asm/*.h files, yet. (It was the same, when I tried 2.4.13) Therefore, I couldn't use the same config as 2.4.4. I was using 2.4.4 kernel that comes with my distribution. Most of kernel drivers/options are compiled in or compiled as module. I'm using kernel optimized for my test PC now. Kernel may crash with other options/modules... Anyway, PHP behaves much better with newer kernel. New behavior is as follows. * PHP outputs the top part of the test script "<?php phpinfo(); ?>" correctly. * PHP sends a lot of garbages with the test script. * Kernel seems to stop freezing. + PHP stopped complaining about many memory leaks at shutdown. Problem: * When memory limit is enabled, PHP do not terminate script execution even if it is already exhausted memory. (I get multiple error message for a single execution as attached apache error log) * PHP can't send proper phpinfo() output. * PHP segfaults with my scripts. I changed bug type form Zlib Related to Reproducible crash. If your PHP does not segfault easily, please let me know. I'll send back trace. == apache error log start == /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) /home/yohgaki/public_html/test/phpinfo.php(1) : Fatal error - Allowed memory size of 8388608 bytes exhausted at zlib.c:995 (tried to allocate 2915587 bytes) == end == ------------------------------------------------------------------------ [2001-10-27 16:24:56] [EMAIL PROTECTED] Just an update. Better procedure to reproduce this bug. I can reproduce this bug on RedHat 7.1(kernel 2.4.7) and Kondara 2.0(Kernel 2.4.4) I think this bug is *critical* and better to be fixed/workarounded before 4.1.0 release.... (Or disable zlib.output_compression?) Caution: This can crash your linux kernel and may crash filesystem. 1) Get 4.1.0RC CVS source 2) Copy php.ini-recommend to php.ini and enable zlib.output_compression zlib.output_compression=On 3) configure/build/install PHP 4.1.0RC './configure' \ '--with-apxs' \ '--disable-short-tags' \ '--without-mysql' \ '--without-pear' \ '--with-zlib' \ '--enable-debug' 4) Create test php script containing <?php phpinfo(); ?> 5) restart httpd, diplay the test script 6) Stop httpd and check apache error log see if memory leak is reported or not. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/?id=13806 Edit this bug report at http://bugs.php.net/?id=13806&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]