Live site, getting numerous 502 Gateway errors. Have cached blocks, Views, disabled unused modules and optimized site per Pantheon recommendations but nothing helps.
Submitted a support ticket to Pantheon with the following message:
The following error was logged when the 502 Gateway message displayed.
Warning: include(): Failed opening ‘/files/civicrm/templates_c/en_US//%%E6/E60/E605AABC%%contactFooter.tpl.php’ for inclusion (include_path=‘.:/code/profiles/cm_starterkit_moderate/modules/civicrm/:/code/profiles/cm_starterkit_moderate/modules/civicrm//packages:.:/usr/share/pear:/usr/share/php’) in Smarty::smarty_include() (line 1907 of /code/profiles/cm_starterkitmoderate/modules/civicrm/packages/Smarty/Smarty.class.php).

Pantheon Dashboard Errors – Message Allowed memory size of 268435456 bytes exhausted (tried to allocate 14487506 bytes)

Received the following message from Pantheon:
We’ve completed investigation of this error, and come to the conclusion that this template compilation process is causing segfaults, which then result in the 502 response from the server. The memory exhaustion is contributing to the segmentation faults, so you’ll want to disable any extraneous modules or features to get this application’s memory footprint down and avoid out of memory errors. I would also recommend reporting this issue to the CiviCRM StarterKit distribution maintainer and provide with the attached logs:

https://gist.github.com/suzannealdrich/5be57ae9358a3c0c2d24

https://www.drupal.org/project/civicrm_starterkit

Since our CivCRM version is part of the kit, I'm posting here rather than project/civicrm_starterkit. Should I also post to CiviCRM Stack Exchange?

Comments

soniat’s picture

Issue summary: View changes
soniat’s picture

Received 502 Bad Gateway Error Message. I had just created a new CIVICRM event, went to CiviCRM Manage Event Page (civicrm/event/manage?reset=1) then selected Registration(Test-drive)

nubeli’s picture

A client of ours has also been getting the same 502 Gateway error. It doesn't seem like it's happening all the time. When I contacted Pantheon they mentioned that they don't officially support CiviCRM so we'd need to contact the civicrm_starterkit maintainer (who doesn't have much capacity).

How big is your CiviCRM database? I'm wondering if we find ways to shrink it if that would help. Perhaps delete old log entries and mailing entries which are huge after 7 years.

toddwoof’s picture

CiviCRM doesn't work on Pantheon.

We spent months trying to solve similar problems with periodic failed page loads, bad gateway errors, and so on. In our case, the main problem was Pantheon's two server-head environment for Business-tier sites, which doesn't work with Civi's caching method. Also the environment seemed resource-starved, or at least poorly tuned, leading to out of memory errors and other performance problems.

Pantheon offered no support, aside from standard brush-off suggestions like "use fewer modules," and pointing out that there were lots of PHP errors in the logs (which supposedly was our problem).

Finally we moved the site to BlackMesh, and not surprisingly, all the PHP errors went away, and the site works properly without any of the page load problems and bad gateway errors.

My suggestion: Move the site off of Pantheon, and save endless hours of needless troubleshooting.

nubeli’s picture

I've created a possible fix here: https://www.drupal.org/node/2096467#comment-9974217 which bypasses CiviCRM's attempt to load the config from cache. (Though I believe a related problem is that the config might also be saved in the session.) Fingers crossed my hack works under heavier loads. As for the other issues @toddwoof raised: out of memory errors and other performance problems, not sure if this will help with that.

TheBarnacle’s picture

The solution at #5 fixed the problem for me. However, the implications are worrying as every time we upgrade CiviCRM we will have to re-apply this patch.

nubeli’s picture

I've reported the issue to CiviCRM and looks like it might get fixed in the next version, 4.7, hopefully: https://issues.civicrm.org/jira/browse/CRM-16618. Though I think a proper fix will be a bit more involved then just commenting out a couple lines.

TheBarnacle’s picture

I have implemented this fix on a few sites, but one of them is still giving the 502 gateway error when accessing particular contacts. Is there anywhere else you can think of that the cache could be disabled in order to prevent this?

nubeli’s picture

@TheBarnacle, you could take a look here: http://civicrm.stackexchange.com/questions/4464/what-is-required-to-run-... for other ideas. In that forum post linked in stackexchange https://forum.civicrm.org/index.php?topic=35125.0;nowap they talk about a hack to get Civi to store Smarty templates in Redis. I haven't gotten that hack to work yet -- I'm talking with that developer to see what I'm doing wrong.

whitefuse’s picture

Does anyone have any further info on a fix to this? We're still getting this issue on a number of sites despite applying the patch and/or upgrading to 4.7.

Pantheon still have no intention of providing any assistance.