PHP5-FPM consuming all CPU, 504 Gateway Time Out
OS: Ubuntu 12.04 i386; 3.8.0-29-generic (current updates as of now) EasyEngine: 1.3.0
This system has 512 MB of RAM, so it is a bit small. I create a site with --wpfc and it works fine ("shell" WP site) Then I install 15 plugins I had installed on my backed up WP site (which was hosted elsewhere also with 512MB RAM but on Apache) and it's still working fine. Then I restore the main DB and PHP5-FPM goes wild:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4539 www-data 20 0 100m 14m 9760 R 15.3 2.9 0:45.78 php5-fpm 4533 www-data 20 0 102m 27m 21m R 14.9 5.6 1:05.74 php5-fpm 4535 www-data 20 0 100m 24m 19m R 14.9 5.0 1:06.02 php5-fpm 4544 www-data 20 0 100m 14m 9788 R 14.9 2.9 0:07.60 php5-fpm 4545 www-data 20 0 100m 14m 9776 R 14.9 2.9 0:07.54 php5-fpm 4538 www-data 20 0 100m 19m 14m R 14.6 3.9 0:24.43 php5-fpm ... I used default EE settings for everything. I tried adjusting some PHP5-FPM parameters and I recreated the entire site but I can't get around it.
I set "pm = ondemand" in www.conf and that seems to have helped a bit, but only initially and now I'm back to the same situation (the max. number of servers is now set to 4, so php5-fpm processes are consuming close to 100% of CPU). It seems that default values set in EE are quite high...
Any idea what could be wrong here? This WP site is basically idle and there are no other services except what's started by EE so it should be able to show pages.
Update 1: I tried various things, like "--wp" (same issue), "--w3tc" (same) and with 1GB RAM (same).
I get this error in Nginx: 2014/04/13 17:33:01 [error] 16221#0: *3 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 1.2.3.4, server: domain.com, request: "GET /wp-login.php?redirect_to=http%3A%2F%%2Fdomain.com%2Fwp-admin%2F&reauth=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "domain.com"
Hi there
Yeah I'm not sure why but I have this collection of vm's
4 Ubuntu 12.04 64 bit, 512 ram digital ocean droplets.
2 on EE 1.3 2 on EE 1.2
My vm's on 1.3 have gone down in the early morning both displaying errors connecting to the database.
@coreyallen is it possible for you to provide us access to your server?
It will help us better understand the issue. You can email me login details on [email protected] (please mention this thread) or add my public-key to your server and just email me user and ip to connect on.
my public-key:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7tDVPV0UKE9MAc+PfKiKorJc1UBppxCUYHNVTzxLSeSD9zphaoz/KXBhMXlqQO5BkAPx8BTctD1nBwEtzLr0TUfD1Y4dlJs/TPIoqtk/shFvCnFlUW0DMnUlKPMLurD9x8/Gu85UGGJRX1qeQwgx15iTPToY5P92Ik9WnruUILjiN+by5PyHCcJeihPnbSJsS9GjEcpJW5/k3pgrhMgaQDZZ0+MkLp3SAihXLnfw7pskPimosVoDXKDenAPe0SmBs/SmOXGfUrKNnQPWZHS8uYhj3nRle9A64vlNPwllaBXI+09o7McJ1ov1L2Zay1VjAwrAgVw6ZP9aOfWAgCpruw== [email protected]
I'll need to check with my clients. If they don't approve I'll make a duplicate of the servers, remove their sites and install dummy sites instead.
I suspect there is some unexpected change to php config.
A trick would be to add a git remote to /etc/php5/ folder. EasyEngine has all configs in git version control. If we can get that folder with git version history, that might do the trick.
Everyone who reported issue is faced after running ee update. Please confirm if anybody here faced issue with new easyeninge setup.
Steps to find diff:
cd /etc/php5/ to go to php5 config folder
git log --pretty=oneline to list log
You will see something like:
06c845d8105c0d22a92c4a4de9449c3d3d46bb4a After Updating EasyEngine To 1.3
73bcca789bfc0f0c137db7b628e5c2dcde8db7f9 Before Updating EasyEngine To 1.3
14851b5dfea0004257dcc9da8d0206e27a06e32a Before Updating EasyEngine To 1.2.1
a51aac4502c70da9527f9eb8f8915bb8c6e14816 After Updating EasyEngine To 1.1.1
9773a4c00d138d2b16d4c4405376880b8d4d45c4 Before Updating EasyEngine To 1.1.1
b5edd540e7a19edebc72863a33f43a651a92bc40 Initialise Git On /etc/php5/
Then run git diff OLD_COMMIT_ID NEW_COMMIT_ID > /patch/file/path
Example below:
git diff 73bcca789bfc0f0c137db7b628e5c2dcde8db7f9 06c845d8105c0d22a92c4a4de9449c3d3d46bb4a > ~/eediff
06c845d8105c0d22a92c4a4de9449c3d3d46bb4a and 73bcca789bfc0f0c137db7b628e5c2dcde8db7f9 are commit ID taken from git log command for after and before easyeninge 1.3 commits.
Then please submit content of ~/eediff or that file for review. You can email it. You can paste it as public gist/pastebin. There is nothing secret ~/eediff file
@rahul286 and others, thanks for your suggestions. I put (already) my server architecture info in my original post at the top, it's an i386 OS. (Incidentally, also on DigitalOcean). I spent the rest of the day monkeying around with this and couldn't find a way around it.
Just now I created a new OS (12.04, 512 MB RAM but unlike before, this time a 64 bit OS and I just used "--wp"). So far so good (php5-fpm isn't anywhere on top output, which is great!). Now I'm done with i386 and various caching options and I won't be able to provide detailed debugging info, but in order to help others, here's my working setup:
- Ubuntu 12.04 x64 with 512 MB of RAM (what's changed vs. before: I had i386 before)
- In restoring my WP backup I used a more conservative (and also "wrong") approach: first restore the DB, then manually install all plugins (I had a list of all plugins saved from the old site). I think there's reasonable likelihood that I may have had a plugin which couldn't be restored the usual way and which was causing problems (what's changed vs. before: I only restored the DB and everything else I did manually). I wish I could provide more details, but I had 20 plugins and yesterday I didn't try to add them one by one. Right now I've added 10+ essential ones and the rest I'll add at a slow rate of one-two per day, hoping that my WP setup doesn't fall apart as I go.
I am now planning to run without cache until EE supports on-the-fly change of caching setup, so as far as I am concerned this can be closed, but I won't close this issue since I see others are seeing similar problems. If maintainers want to close this that's fine with me.
@rippler thanks for details.
I just want to know if anybody facing issue was using Debian 6/7? We don't use Debian. We don't use Ubuntu 32-bit.
But we checked git log on few servers and www.conf wasn't touched on any of them!
Let's keep this issue open for few days. This issue has too many people to take this lightly.
+1 on this issue on upgrading to 1.3
Although for me, my memory + swap went to 100% more or less.
Email sent to [email protected].
For now, changed over to the above with ondemand and the timeout 10s. Seems to have settled the memory hog down quite a bit.
@jdtoppin thanks for giving us access to your server and allowing us to test on it.
@All We are really sorry to say after debugging for 4 days on many servers we are not able to reproduce any issue.
Please note: ondemand when compared with dynamic will result in less RAM usage (on most servers)
Goal of our debug marathon was to find out: what was changed during ee update when upgrading to version 1.3.
I am sorry to say, we are not successful. Almost 8-10 people reported this issue. In some cases, server crash occurred because swap memory was disabled (DigitalOcean I think do not enable swap by default).
So as of now, we have decided to make FPM process management ondemand always.
If anybody finds any reason for what has happened, please let us know.
In version 1.3.4 we have decided to make ondemand as default. You can run upgrade using ee update.
It will upgrade nginx also to latest stable version. (release post - https://rtcamp.com/easyengine-1-3-4-better-ubuntu-support/ )
We couldn't reproduce issue on any server but we are grateful to everyone who participated in the discussion and provided us login to their server for debugging purpose.