We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

zend_mm_heap corrupted on db query

Hi!

After upgrade php from 7.4.7 to 7.4.8 my app crashed at any DB query or DB model usage with no any error messages or info at the trace. The only message I found is zend_mm_heap corrupted.

Example:

$db->fetchAll('select * from `Option`')

is OK, but

Option::findFirst();

or

$q = $this->modelsManager->createBuilder()->from(Option::class)->getQuery();
$res = $q->execute();

is failed :(

any ideas?

thanks!

thank you!

but what the solution? downgrade to 7.4.7 ?



4.0k
edited Jul '20

Right now - yes. Personally, for me worked switching to 7.3.20 too, since I couldn't downgrade to 7.4.7.

Also, from the Discord, but I didn't test it yet:

building from source fixed it, if anyone else runs into the same issue, but I'm curious as to the cause and also how I can provide details for the core team to investigate? FYI, I've reinstalled it via PECL and it also works again so cannot be too serious :slight_smile:

edited Jul '20

since I couldn't downgrade to 7.4.7

if you have cached previous versions, you can try:

sudo dpkg -i /var/cache/apt/archives/php*7.4.7*

and, to prevent upgrade create /etc/apt/preferences.d/php with:

Package: php7.4*
Pin: origin ""
Pin: version 7.4.7*
Pin-Priority: 1111
edited Jul '20

If you see the error zend_mm_heap corrupted in the global PHP-FPM error log file at /var/log/phpX.Y-fpm-sp.log, the most likely cause of the problem is a buggy PHP extension crashing PHP.

PHP extensions include the New Relic PHP extension and any PECL extension, such as memcache, redis, and others.

Step One: Disabling Third-Party PHP Extensions If you are seeing "zend_mm_heap corrupted" in your logs, you should disable all third-party PHP extensions until you can identify which one is causing the problem

To disable a PHP extension, SSH into your server as root and then rename the extension's file at

/etc/phpX.Y-sp/conf.d/EXTENSION.ini to:

/etc/phpX.Y-sp/conf.d/EXTENSION.ini.disabled Next, restart PHP by running this command as root:

sudo service phpX.Y-fpm-sp restart Replace "X.Y" with the version of PHP, for example "5.6".

Ive faced this issue and this is what you should do after upgrading. Assuming you install phalcon using brew, uninstall phalcon through brew and install phalcon using PECL command instead. This is what i did at my Mac. For some reason the phalcon repository for brew is not updated and needs to be rebuild.