Segmentation Fault errors in Prestashop 1.5/1.6
  • 10

Segmentation Fault errors in Prestashop 1.5/1.6

One of our clients has recently suffered continual problems with their Prestashop deployment and after finally getting to the bottom of the problem I thought I would share the information.

The Problem

The site was running a commercial grade VPS with a separate database server, load balancer, and 3 front-end web servers (Cent-OS). We noticed that the web servers were continually failing for no apparent reason and the apache error_log was filling up with Segmentation fault errors:

[notice] child pid ###### exit signal Segmentation fault (11)

The CPU load was also extremely high on the servers, frequently spiking up to 100% and memory usage was also bizarrely high with each httpd instance taking up 120mb – 200mb or more. We raised a support ticket with our server vendors and we were advised to raised the MaxClient value in the php setting or add additional servers to the farm to help manage the load but our traffic was not THAT high and something clearly wasn’t right.

After repeated chasing (4 weeks worth to be exact) we eventually got hold of a decent engineer and he traced the problem back to the APC caching module for PHP and a conflict with Prestashop’s “smartycache”.

The Fix

  1. The first step was to completely disable the APC cache in the Prestashop back-end (under “performance”). The setting can also be changed under config/settings.php if you need to push the change out to multiple servers. This step brought down CPU and memory usage dramatically on the server and restored stability but we were still seeing occasional segmentation fault errors.
  2. The next step was to remove APC completely from the server and replace it with Zend OpCache which is recommended by Prestashop:
  3. With APC removed the segmentation fault errors have completely disappeared and the server seems to have completely stabilized. Our final step then was to reset the MaxClient in the http config to the correctly level for the server. You can calculate this easy enough by looking at the average memory usage for each httpd instance:
    # ps -H h -ylC httpd | perl -lane '$s+=$F[7];$i++;END{printf"Avg=%.1fMB\n",$s/$i/2048}'

    And then diving this into your main memory on the server (replace 2048  in above command). Don’t forget to leave some memory for your OS though so subtract 500mb-1024mb from your main memory depending on what else is running on there.

  4. With MaxClient set correctly and APC removed our Prestashop is running much better and (touch wood) so far no problems have been reported.


I hope this helps someone

Leave a Reply

Contact Us