2

Setting PHP's opcache parameter to 1 (on, the default) is giving me 'zend_mm_heap corrupted' errors in the Apache log file at a rate of a few a day, irregularly.

Previous StackOverflow answers have suggested this might be because of (a) using other caching modules such as APC - not the case here, as only the standard PHP distribution is being used without any non-native caching or (b) running out of memory - but I have at least 1.6G of swap space available according to free -m or (c) a bug in the PHP compiler - unlikely as this error is not widely reported and I am not doing anything unusual.

The server runs several websites, built using Drupal, Joomla, and bespoke PHP. I am running a standard PHP5.6.36 with mod_php and Apache 2.4.33 using the event MPM on Amazon Linux 2.

The only thing that is not completely standard stuff is that I am using the Amazon AWS SDK for PHP v. 3 to send mail, but I have no reason to suppose that this is causing the problem.

How can I track down what is causing the heap corruption?

Nigel
  • 585
  • 1
  • 5
  • 20
  • I had 60 consecutive error_log lines over June 25th thru June 30th with this same on CentOS 7 and PHP v5.5.382.0 Apache/2.4.6 interestingly the server continued to run apart from a little down time – sakumatto Jun 30 '18 at 16:27

1 Answers1

2

Looks like this bug has been reported. Within the comments it's suggest to set the following within php.ini:

opcache.revalidate_freq=7000
opcache.fast_shutdown=0
steadweb
  • 15,364
  • 3
  • 33
  • 47
  • I made these settings. The rate of `zend_mm_heap corrupted` messages has decreased - only two in the last 24 hours - but they have not gone away. The puzzle is why I am getting this, although using a rather standard PHP set up, when presumably most others do not get these errors. Hence my question seeking the cause (as well as the solution). – Nigel Jun 10 '18 at 22:00
  • Joe Watkins has provided a good explantion as to why this might occur (https://stackoverflow.com/a/36350601/1050507). Unfortunately this isn't an easy issue to debug. The recommendation is to either disable opcache or find the code that's causing the issue. – steadweb Jun 11 '18 at 08:48