Topic: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

After upgrading php70-php-pecl-apcu.x86_64 to "0:5.1.4-1.el6.remi ", php-fpm processes crash "randomly". FPM logs:

[13-May-2016 14:01:41] WARNING: [pool www_tcp_php7] child 29150 said into stderr: "zend_mm_heap corrupted"

Downgrade to "php70-php-pecl-apcu.x86_64 0:5.1.3-1.el6.remi" resolves the problem.
I don't know the root cause, I'm just reporting the problem.

uname -a
Linux xyz 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

Can you please open a upstream issue on https://github.com/krakjoe/apcu/issues

A backtrace would be usefull.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

I think I have a repeatable testcase:

https://github.com/krakjoe/apcu/issues/185

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

5.1.6 is released, please try it (of course, available in the repo)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

I'm still getting "zend_mm_heap corrupted" in php-fpm error log when using:

Installed Packages
php70-php-pecl-apcu.x86_64                        5.1.7-1.el6.remi                     @remi
php70-php-pecl-apcu-bc.x86_64                     1.0.3-1.el6.remi                     @remi
php70-php-fpm.x86_64                         7.0.14-1.el6.remi                         @remi

I can't get a repeatable test case. It happens after several minutes of php-fpm run. fpm restart resolves the issue for some time.

Please could someone teach me, how do I get anything useful (backtrace, core dump....) on php-fpm? I don't see any message about core dump created, nothing.

I've set:

echo '/tmp/coredump-%e.%p' > /proc/sys/kernel/core_pattern
rlimit_core = unlimited

But can't get anything useful. The child exits with code 1.

Thank you

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

You probably need to run it with USE_ZEND_ALLOC=1 (notice: this disable memory_limit)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

USE_ZEND_ALLOC=1 is ON by default, isn't it? So you meant I should use USE_ZEND_ALLOC=0 ?

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

Of course, I mean 0 (disable php internal memory manager and use standard malloc/free, which should raise segfault)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

When I put

env[USE_ZEND_ALLOC]=0

in my php-fpm config,

var_dump(getenv('USE_ZEND_ALLOC'));

returns string(1) "0", which is OK. But phpinfo() stiil reports:

"Zend Memory Manager    enabled"

I'm quite confused now...

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

you need to set it "before" FPM is launch, so in /etc/opt/remi/php70/sysconfig/php-fpm

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

/etc/opt/remi/php70/sysconfig/php-fpm didn't work either.

But specifying the variable on command line is working. Next time I should try it first smile

# USE_ZEND_ALLOC=0 /etc/init.d/php70-php-fpm restart

Now phpinfo() reports:
Zend Memory Manager    disabled

However, all requests fail on this error now:

WARNING: [pool www_tcp_php7] child 5691 said into stderr: "Out of memory"

Setting pm.max_requests = 2 doesn't help. Is there any workaround?

I really appreciate your fast replies Remi, it's unbelievable smile

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

> WARNING: [pool www_tcp_php7] child 5691 said into stderr: "Out of memory"

Strange. I wil try to reproduce, BTW, not before tomorrow, being AFK now.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php70-php-pecl-apcu.x86_64 0:5.1.4-1.el6.remi zend zend_mm_heap

Hi Remi, did you please manage to reproduce this behaviour? Thank you