1

We have an install of the latest Craft on a Nexcess shared account. By default, the account runs PHP 5.4.x. We were working on and configuring the site for about a week - no issues of any kind until today. We used the Nexcess control panel to update the PHP version to 5.6.3 (for a plugin we were going to use). After doing so, we found that saving entries or certain configuration elements in settings would take 5+ minutes to complete. We downgraded back to 5.4.x and still the behaviour persists. Unfortunately, it does not seem to be 100% consistent. I would say it happens about 90% of the time and cannot find any common thread as to when it happens and when it does not.

Saving one entry is generating about 1.4 MB of Craft log files:

Craft Log 1

Craft Log 2

Beyond the Craft logs, I don't see a php error in the PHP logs but there are these Apache errors when saving the entry:

[Fri May 05 07:28:46 2017] [error] [client xx.xx.xx.xx] FastCGI: incomplete headers (0 bytes) received from server "/dev/shm/cadexdev-php.fcgi", referer: http://www.cadex-dev.ca/shop/admin/entries/multiUse/new

I don't know if this is host-related. I do have a ticket open with Nexcess but am not certain if this is something specific to Craft instead?

EDIT: Also, a curious behaviour around this issue. If I save an entry and only wait, say, 20 seconds, quit my browser and then re-open and go to the entries page, the entry is there with the saved changes. No 5+ minute wait.

  • Just a comment for now... This was all in devmode. I took the site out of dev mode and no issues on any verison of PHP. Can anyone comment on this? Could it only be devmode and the time to write out alot of debug stuff in the Craft logs? I have worked in devmode a fair bit and never recall such slowdowns. – Mike May 5 '17 at 13:09
2

Had this happen. I believe the cause is twofold:

FastCGI's -idle-timeout is set too low.

Craft is still writing to the log but Apache cuts it off since it hasn't sent the actual data yet. That's what the incomplete headers means.

You'll might find a line like this in your config:

FastCgiServer /dev/shm/cadexdev-php.fcgi -idle-timeout 10

Some hosts might set it low, like 10 seconds. That could be fine for production to make sure scripts don't take a super long time, but as you've discovered devMode could take a little longer to run, depending on the case.

RunTasksAutomatically

The other piece is Craft does things in the background. Craft's documentation on runTasksAutomatically says:

This setting should be disabled for servers running Win32, or with Apache’s mod_deflate/mod_gzip installed, where PHP’s flush() method won’t work.

Some of those tasks clear caches and stuff. If they don't run, you'll get weird intermittent performance issues. Turn it off and run a cron job on your server periodically. We run php-fpm on both Apache and nginx and FWIW, we don't have this issue on nginx.

Increase PHP's memory

You'll also get a 500 / incomplete headers error if PHP dies because of lack of memory.

| improve this answer | |
  • 1
    Thanks - very helpful! The idle-timeout makes sense especially since it was clearly writing a lot to the logs in decMode. – Mike May 9 '17 at 16:42
1

Well, it seems this was related to devMode. I have had no further issues with it off.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.