Edit report at http://bugs.php.net/bug.php?id=40479&edit=1

 ID:               40479
 Comment by:       php at foxteck dot org
 Reported by:      rrossi at maggioli dot it
 Summary:          zend_mm_heap corrupted
 Status:           No Feedback
 Type:             Bug
 Package:          Reproducible crash
 Operating System: Suse Linux 9.0
 PHP Version:      5.2.1

 New Comment:

Just for history/logging purposes, I got this same error on PHP 5.2.6 +
MySQL 

5.1 + Apache/2.2.4 (Unix) mod_ssl/2.2.4 

OpenSSL/0.9.7a DAV/2 + SuPHP on RHEL 4 today. 



It was related to mysql_* calls, phpinfo() worked fine, no errors. Any
mysql_* 

call crashed.





Code:

---------------

[erom...@roll tmp]$ cat /tmp/test.php 

<?php 

echo "Hola";

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

if (!$link) {

    die('Could not connect: ' . mysql_error());

}

echo 'Connected successfully';

mysql_close($link);





Reproducing

---------------

[erom...@roll tmp]$ /usr/local/php5-cgi/bin/php-cgi /tmp/test.php 

zend_mm_heap corrupted





Worked fine with USE_ZEND_ALLOC=0 

---------------

[erom...@roll tmp]$ export USE_ZEND_ALLOC=0

[erom...@roll tmp]$ /usr/local/php5-cgi/bin/php-cgi /tmp/test.php 

PHP Warning:  mysql_connect() [<a
href='function.mysql-connect'>function.mysql-

connect</a>]: Can't connect to local MySQL 

server through socket '/tmp/mysql.sock' (2) in /tmp/test.php on line 2

X-Powered-By: PHP/5.2.6

Content-type: text/html



HolaCould not connect: Can't connect to local MySQL server through
socket 

'/tmp/mysql.sock' (2)







Updating to 5.3.2 fixed the issue.



Here's the config line I used in BOTH 5.2.6 and 5.3.2, everything
compiled fine 

both times. Disregard the unused flags:



'./configure' \

'--prefix=/usr/local/php5-cgi' \

'--with-curl' \

'--with-freetype-dir=/usr' \

'--with-png-dir=/usr' \

'--enable-gd-native-ttf' \

'--with-jpeg-dir=/usr' \

'--with-png' \

'--enable-magic-quotes' \

'--enable-sockets' \

'--enable-sysvsem' \

'--enable-sysvshm' \

'--enable-sysvmsg' \

'--enable-track-vars' \

'--enable-trans-sid' \

'--enable-yp' \

'--enable-wddx' \

'--with-pear=/usr/share/pear' \

'--with-kerberos' \

'--with-mysql=/usr/local/mysql' \

'--with-mysqli' \

'--with-pcre-regex' \

'--disable-cli' \

'--enable-cgi' \

'--enable-mbstring' \

'--enable-fastcgi' \

'--enable-force-cgi-redirect' \

'--enable-discard-path' \

'--with-oci8=instantclient,/usr/lib/oracle/11.1.0.1/client/lib' \

'--with-gd' \

'--with-zlib' 





Cheers,

Eduardo Romero

http://foxteck.org


Previous Comments:
------------------------------------------------------------------------
[2009-11-16 19:16:03] gfmailweb at gmail dot com

Adding 

export USE_ZEND_ALLOC=0

to apache2ctl on Ubuntu Hardy worked for me too.

------------------------------------------------------------------------
[2009-11-12 13:38:31] astehlik at intera dot de

I can confirm, that my apache crashed with the error "zend_mm_heap
corrupted" under heavy load. After that I get a lot of Segmentation
faults (11).



OS: CentOS 5.4

PHP: 5.2.11 

Apache: 2.2.14



The server is running as a virtual machine in an ESXi 3.5 Server.



I'm now testing the "export USE_ZEND_ALLOC=0" workaround in my
apachectl. I'll provide more feedback as soon as I know if this helps.

------------------------------------------------------------------------
[2009-10-27 14:54:49] mike at blueroot dot co dot uk

I see this error all the time on my complicated application.  I am using
php-fcgi + nginx + mongodb so I am fairly sure it is something in core.



I find that even a small change can fix the problem, output buffering
seems to be the culprit for me (ob_end_flush() seems to fix it) which is
maybe why people can only reproduce on production servers?

------------------------------------------------------------------------
[2009-10-14 20:43:45] tulio dot silva at mpt dot gov dot br

Hi all,

in answer to sriram above, here we go:



-bash-3.00$ /usr/local/apache2/bin/httpd -V

Server version: Apache/2.2.13 (Unix)

Server built:   Oct  5 2009 10:20:45

Server's Module Magic Number: 20051115:23

Server loaded:  APR 1.3.8, APR-Util 1.3.9

Compiled using: APR 1.3.8, APR-Util 1.3.9

Architecture:   64-bit

Server MPM:     Prefork

  threaded:     no

    forked:     yes (variable process count)

Server compiled with....

 -D APACHE_MPM_DIR="server/mpm/prefork"

 -D APR_HAS_SENDFILE

 -D APR_HAS_MMAP

 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)

 -D APR_USE_SYSVSEM_SERIALIZE

 -D APR_USE_PTHREAD_SERIALIZE

 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT

 -D APR_HAS_OTHER_CHILD

 -D AP_HAVE_RELIABLE_PIPED_LOGS

 -D DYNAMIC_MODULE_LIMIT=128

 -D HTTPD_ROOT="/usr/local/apache2"

 -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"

 -D DEFAULT_PIDLOG="logs/httpd.pid"

 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"

 -D DEFAULT_LOCKFILE="logs/accept.lock"

 -D DEFAULT_ERRORLOG="logs/error_log"

 -D AP_TYPES_CONFIG_FILE="conf/mime.types"

 -D SERVER_CONFIG_FILE="conf/httpd.conf"



So it is prefork. If ZTS is enabled with --enable-maintainer-zts, then
it´s off. Also, from phpinfo(),

Debug Build     no 

Thread Safety   disabled 

Zend Memory Manager     enabled



and it seems USE_ZEND_ALLOC=0 does nothing for me. I´m on CentOS 4.6 on
multi-core AMD64, with nearly 1GB RAM and a very busy server. There are
plenty of custom systems in this machine, so I can´t tell what is
causing it, but it started after we began using Elxis 2009.0 in
production state (about 15 hits/second).



My configure lines includes a lot of other parameters, like oci and
MySQLi, but if of any use, I´ll compare the relevant items with rrossi´s
(bug opener) config.nice:

'./configure' \

'--with-apxs' \ # idem

'--with-mysql=/usr/local/mysql' \ #'--with-mysql=/usr' (CentOS rpm)

'--with-bz2' \ # no

'--with-mcrypt' \ #no

'--with-pgsql' \ #no

'--without-pear' \ # --with-pear



Apache also includes a lot of modules. The most relevant, I guess, are
rewrite, proxy (http & ajp), ssl, and cache. If any other info needed,
feel free (and please) contact me. It´s been a serious problem down
here.

------------------------------------------------------------------------
[2009-09-18 08:24:48] tdikarim at hotmail dot com

Hi ,



I have tested with the version 5.3 of PHP with no success.

I have this error:

Fatal error: Out of memory (allocated 564920320) (tried to allocate
39063398 bytes) in I:\srvDevPHP\PHP_PEAR\File\PDF.php on line 3191

zend_mm_heap corrupted

The line 3191 is << $this->_buffer .= $s . "\n"; >> of the _out
function.



How can i use the USE_ZEND_ALLOC parameter. I don't find any file for do
that.

Somme info:

EasyPhp 2.0.0.0

     php 5.3.0

     Apache 2.2.13



Thanks

Karim

------------------------------------------------------------------------


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/bug.php?id=40479


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=40479&edit=1

Reply via email to