cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Phalcon 1.3.x zend_mm_heap corrupted

Open jiexaspb opened this issue 12 years ago • 45 comments

Hello. Starting from the version of Phalcon 1.3.x we encountered php-fpm errors on the server that happened randomly, on random pages and didn't seem to be logical.

There were such entries in php-fpm logs:

[25-Jun-2014 12:41:53] WARNING: [pool production] child 3033 exited with code 1 after 1770.039968 seconds from start
[25-Jun-2014 12:41:53] WARNING: [pool production] child 3033 said into stderr: "zend_mm_heap corrupted"
[25-Jun-2014 12:39:09] NOTICE: [pool production] child 27071 started
[25-Jun-2014 12:39:09] WARNING: [pool production] child 14483 exited with code 1 after 5006.064858 seconds from start
[25-Jun-2014 12:39:09] WARNING: [pool production] child 14483 said into stderr: "zend_mm_heap corrupted"
[25-Jun-2014 12:38:56] NOTICE: [pool production] child 26871 started
[25-Jun-2014 12:38:56] WARNING: [pool production] child 12402 exited with code 1 after 1027.771509 seconds from start
[25-Jun-2014 12:38:56] WARNING: [pool production] child 12402 said into stderr: "zend_mm_heap corrupted"
[25-Jun-2014 12:38:53] NOTICE: [pool production] child 26823 started
[25-Jun-2014 12:38:53] WARNING: [pool production] child 15005 exited with code 1 after 839.348531 seconds from start
[25-Jun-2014 12:38:53] WARNING: [pool production] child 15005 said into stderr: "zend_mm_heap corrupted"

We couldn't collect any further information about these errors.

First it happened on Debian 6, php 5.4 Then we moved to the server with Debian 7, php 5.5 but the errors were still happening. Downgrade to the Phalcon 1.2.6 solved the problem. We found a similar ticket that almost describes our problem https://github.com/phalcon/cphalcon/issues/2516

Please fix it. Thanks.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

jiexaspb avatar Jun 25 '14 12:06 jiexaspb

I also have this problem. Any one can help us?

kutsy avatar Jul 15 '14 03:07 kutsy

Try to update PHP to 5.5 version

ovr avatar Jul 15 '14 04:07 ovr

Try to update PHP to 5.5 version

$ php -v PHP 5.5.14-1~dotdeb.1 (cli) (built: Jun 29 2014 22:09:43) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

kutsy avatar Jul 15 '14 04:07 kutsy

i have the same issue, php 5.5.xx + phalcon 1.3.2 + ZendOpCache + on OpenSuse 12.3 sometimes this error comes in quick succession.

short extract of apache error log: ... [Tue Jul 15 09:46:46 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:46 2014] [error] [client 46.4.109.202] Premature end of script headers zend_mm_heap corrupted [Tue Jul 15 09:46:47 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:47 2014] [error] [client 46.4.109.202] Premature end of script headers: index.php, zend_mm_heap corrupted [Tue Jul 15 09:46:47 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:47 2014] [error] [client 46.4.109.202] Premature end of script headers: index.php, zend_mm_heap corrupted [Tue Jul 15 09:46:48 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:48 2014] [error] [client 46.4.109.202] Premature end of script headers: index.php, zend_mm_heap corrupted [Tue Jul 15 09:46:49 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:49 2014] [error] [client 46.4.109.202] Premature end of script headers: index.php, zend_mm_heap corrupted [Tue Jul 15 09:46:49 2014] [warn] client 46.4.109.202Connection reset by peer: mod_fcgid: [Tue Jul 15 09:46:49 2014] [error] [client 46.4.109.202] Premature end of script headers: index.php, zend_mm_heap corrupted zend_mm_heap corrupted ... and so on

swen100 avatar Jul 15 '14 07:07 swen100

We have the same problem with apache. Different pages, randomly. Sometimes we catch it on local machine. Php version 5.4.28, phalcon 1.3.2. It started maybe a month ago.

deadkrolik avatar Jul 19 '14 16:07 deadkrolik

Probably related to #2513, #2239 and #2512 The current workaround is to disable OPcache

cvsguimaraes avatar Jul 21 '14 13:07 cvsguimaraes

Oh yeah, fantastic :rage: Sorry.

swen100 avatar Jul 21 '14 14:07 swen100

@swen100 @cvsguimaraes I found a possible workaround see this article: https://bugs.php.net/bug.php?id=65590

tmatei avatar Jul 21 '14 18:07 tmatei

@tmatei Thank you for the link, but I have seen this already some time ago and it sadly has not helped me.

swen100 avatar Jul 22 '14 06:07 swen100

I have the same problem, too, php5.5.12,phalcon1.3.1,nginx1.6.0.

pantaovay avatar Jul 28 '14 16:07 pantaovay

phalcon-1.3.2, php-5.5.14, opcache (7.0.3 and 7.0.4-dev) both same issue

brandonlamb avatar Aug 24 '14 14:08 brandonlamb

tried it out with newest version 1.3.3 and this issue still exists.

swen100 avatar Sep 05 '14 12:09 swen100

Who can we get in touch with to see if they can fix this issue?

tmatei avatar Sep 05 '14 19:09 tmatei

Can someone provide a backtrace?

git clone http://github.com/phalcon/cphalcon
git checkout 1.3.3
cd cphalcon/ext
sudo ./install
cd /path/to/website/public
gdb php
(gdb) run index.php
(gdb) bt full

ghost avatar Sep 05 '14 19:09 ghost

this bug is very very annoying, but not easy reproducable. We have several hundred requests per minute and sometimes it occurs, but we can not figure out at which point or which request it happened... we will not upgrade phalcon to 1.3.x until this bug is fixed. So, please, is there anybody who can give us a backtrace?

swen100 avatar Sep 10 '14 06:09 swen100

@phalcon The problem is that I don't think its reproducible from the command line. For my issues I was able to resolve this by turning off the opcache.fast_shutdown, but it was stated by @swen100 that did not fix his problem. One thing that I know for a fact is that the code was working fine in 1.2.x versions and something was introduced in 1.3.x branch since the very first version. To me it seems like something gets cached in opcache and its there for the next page request, which ends up crashing php. Is there another way to debug this?

tmatei avatar Sep 10 '14 20:09 tmatei

Same issue here. I solved the problem by disabling opcache, restarting apache and re-enabling opcache.

MickaelViaud avatar Sep 12 '14 10:09 MickaelViaud

Hi, how did you re-activate opcache without restarting apache?

swen100 avatar Sep 12 '14 11:09 swen100

It's correct, i restart apache again after re-enabling opcache :)

MickaelViaud avatar Sep 12 '14 11:09 MickaelViaud

We used jmeter to try to test this out, and very inconsistent. There was no way to repeat the problem. Out of say 1000 connections we would get only a small X number of failures. After over a month of this we finally had to downgrade.

brandonlamb avatar Sep 12 '14 18:09 brandonlamb