Jump to content

Smarty memory leak causing fatal errors


Recommended Posts

I've been having memory leaks consistently on Apache, and it always points to this template:

 

 PHP Fatal error:  Out of memory (allocated 22806528) (tried to allocate 1245184 bytes) in /var/www/website/cache/smarty/compile/b252b2866aff75220b588b7bebd06c9aced2705a.file.product.tpl.php on line 845

 

Obviously it happens more often with higher traffic, and it completely blows the server away and prevents anything from being served until the processes are killed.  

 

At first I set apache to restart every night at off-peak hours as a quick workaround.  Then I cut down on the number of servers apache starts, along with child processes and MaxRequestsPerChild.   Everything is set STUPID low to cut down on the number of times it happens, but it hasn't helped so far.  In the last 15 minutes, the server has been forkbombed by that script three times.

 

The server is only 1Ghz with 512MB, but there is no reason that Apache should be eating up that much memory for the few simple sites it's running.  I'm getting less than 300 hits a day to all sites combined, and it's nothing but a few VERY simple Wordpress sites along with Prestashop.

 

It's the same script every time.

 

Under the Performance tab, I've set Smarty to "never recompile," but this error keeps happening.  Cache is enabled.  

 

I'm not 100% sure how Smarty operates, so any help is appreciated.

Link to comment
Share on other sites

What constitutes huge?  I have about 500 products but I'm only serving maybe a few hundred pages a day.  I haven't installed any modules that were not included with the default install, except for Stripe, which hasn't come up in my error log.

Link to comment
Share on other sites

  • 8 months later...

Hello

 

did you get solution for this problem. I'm facing the same problems. Now we are running prestashop on default modules, but this is not solution. We buy all modules on ADDONS so it should be free of bad coding or not!?

 

only difference is that we have 7000 active product and around 400 visitors per day.

 

VPS

2 vCPU

2GB RAM

4GB swap

 

Martin

Link to comment
Share on other sites

Hello DH42

 

thank you for your post. I was just detailed brief by my It support about my problem. We use google mod_pagespeed on server for caching contents and on the peaks of the day server is running out of RAM, because constant indexing of this module. We installed this module because before that we have 12-15 sec load time on pages and this was to high.

 

Now when I was detailed briefed by my IT support I see that the problem is not the same as described above.

 

I read your blog and posts regulary :). I have question for you did you ever tested server with modpagespeed module? and it behaviour with Prestashop? 

 

Here is what is happening and errors that is written to log file:

[Fri Oct 03 21:18:07 2014] [error] [client 144.76.227.102] File does not exist: /home/figurams/public_html/404.shtml, referer: http://www.figura-ms.si/katalog/otroske-majice/566-otroska-polo-majica-sg59k.html

[Fri Oct 03 21:18:29 2014] [error] [client 207.46.13.92] File does not exist: /usr/local/apache/htdocs/robots.txt

[Fri Oct 03 21:21:42 2014] [error] [client 93.143.249.29] client denied by server configuration: uri /img/cms/765x276xbomb,P20girl.jpg.pagespeed.ic.RjG0MS1M_m.webp, referer: http://www.trgovina-figura.si/hr/zenske-kosulje-tunike/4979-figl-zenska-klasicna-kosulja-m021.html?gclid=CP-JtKOakcECFavpwgodpk8AmA

[Fri Oct 03 21:22:57 2014] [error] [client 109.60.45.107] client denied by server configuration: uri /img/cms/765x276xbomb,P20girl.jpg.pagespeed.ic.RjG0MS1M_m.webp, referer: http://www.trgovina-figura.si/hr/zenske-kosulje-tunike/4979-figl-zenska-klasicna-kosulja-m021.html?gclid=CKW5r8eakcECFavpwgodpk8AmA

[Fri Oct 03 21:24:41 2014] [error] [client 173.252.120.113] client denied by server configuration: uri /img/cms/765x276xbomb,P20girl.jpg.pagespeed.ic.-bZv6CxqXf.jpg, referer: http://www.trgovina-figura.si/hr/haljine/4976-figl-zenska-haljina-m053.html

[Fri Oct 03 21:24:43 2014] [error] [client 173.252.114.119] client denied by server configuration: uri /img/cms/765x276xbomb,P20girl.jpg.pagespeed.ic.-bZv6CxqXf.jpg

 

I guess they have to do some Apache tunning and debugging, but this takes time and money :(

 

Thanks for any comments

 

Martin

Link to comment
Share on other sites

I personally would not run pagespeed, while it is a good module, it just automates optimizing the site. Just have the site optimized and not use pagespeed. I have also noticed it is resource intensive at times as well. Where are you hosted and what type of account do you have?

Link to comment
Share on other sites

Thank you very much for comment

 

I have our local company which is providin hosting for VPS and the are also providing me with support on MySQL and apache  optimization on server

 

here is link to his site

http://www.guttierrez.org/site/

 

I have VPS with 2vCPU, 2GB RAM, 40GB space, running on Cloudlinux system and Cpanel+WHM

 

Do you have other suggestion for caching system? I belive I can help them to find best solution for my Prestashop web sites. He can help me with settings on server, but not on tunning the Prestashop. 

 

but the results on GTmetrix is very good for my site:

http://gtmetrix.com/reports/www.trgovina-figura.si/yv3jMuwj

 

Martin

Link to comment
Share on other sites

I personally would not run pagespeed, while it is a good module, it just automates optimizing the site. Just have the site optimized and not use pagespeed. I have also noticed it is resource intensive at times as well. Where are you hosted and what type of account do you have?

 

 

I would suggest them to put php in fastcgi mode and use apc caching to handle the frontend php caching. 

 

 

both excellent suggestions (fastcgi!)

 

for apc caching, dh42 do you suggest 'not' enabling apc in PrestaShop and letting apc work naturally?

Link to comment
Share on other sites

Depending. If you let prestashop manage it, it uses APCu  I think and caches data from the database to APC. I have only had one site that caused problems with when it came to stock issues. If you do not keep stock, I would set it if you are using a later version of 1.5 or 1.6, in the early versions it did not work correctly and slowed the site down. 

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...