3

I am getting "zend_mm_heap corrupted" when run a script to screen scrape a webpage. Please let me know, how to fix this issue.

3 Answers3

1

I will assume you are using Apache w/ mod_php for this answer.

I was getting this error when apache was spawning too many instances eating up all the RAM, and then would attempt to use the disk swap, and then responses would keep slowing down until it would eventually crash, and it would SEGFAULT. Restarting the apache service would bring everything back up, until it boiled over again minutes or hours later.

Here's an article that helped out in my situation: https://servercheck.in/blog/3-small-tweaks-make-apache-fly

Basically, see how much each apache process is using (may be httpd or nginx on your server):

ps aux | grep 'apache' | awk '{print $6/1024 " MB";}'

Find the average MB usage per process, in my instance it was about ~40MB per process.

Next find out how much RAM you have available to your apache. My server had roughly 3.8GB of RAM available to Apache. So I took 3800 MB divided by 40 MB, and got 95. So I set my MaxClients to 95. So far I have not seen apache spin out of control on my server since I've implemented these changes. When it was 150, it was crashing ever 8 hours or so, when it was at 250 it was coming down every half an hour.

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients           95
    MaxRequestsPerChild 100
</IfModule>

As suggested by other, I had tried turning up my output buffering from 4K, all the way 128K with not much improvement in the error. Also try turning down your "Timeout" parameter, if you don't have any longer running processes. In my network nothing should take more than a few seconds to process and deliver. The high (IMHO) default of 300 was reduced down to 15 seconds, this helped with any instances that got stalled as well.

Before this I'd see loads reaching close to 130 or so, which the system should be non-responsive but everything else was fine. Your issue just may be your Apache mod_php settings are simply too aggressive for your server.

Hope this helps!

Justin Fortier
  • 451
  • 5
  • 6
0

Try to increase output_buffering in php.ini

Refer to this question output_buffering

Community
  • 1
  • 1
Samy Massoud
  • 4,295
  • 2
  • 35
  • 48
  • thanks for your response. output_buffering didn't help to fix that issue. –  Mar 31 '14 at 13:22
0

1)Can you give us some code to look at ? 2)Meaby increasing output_buffering in php.ini can do the trick and make sure You remove all unneeded references.

Uriziel
  • 177
  • 1
  • 10