php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42180 php in fastcgi environment periodicaly get 90% of CPU
Submitted: 2007-08-02 13:52 UTC Modified: 2008-07-11 21:28 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: a dot simonov at favoritbet dot com Assigned:
Status: Wont fix Package: CGI/CLI related
PHP Version: 4.4.7 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a dot simonov at favoritbet dot com
New email:
PHP Version: OS:

 

 [2007-08-02 13:52 UTC] a dot simonov at favoritbet dot com
Description:
------------
php in fastcgi environment periodicaly get >90% of CPU and >1.5g of memory

fast-cgi environment:
SPAWNFCGI="/usr/local/bin/spawn-fcgi"
FCGIPROGRAM="/usr/local/bin/php"
FCGIPORT="8888"
PHP_FCGI_CHILDREN=200
PHP_FCGI_MAX_REQUESTS=2000
FCGI_WEB_SERVER_ADDRS="127.0.0.1"
ALLOWED_ENV="PATH USER"
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"

periodicaly i have in top:
4968 www-data  19   0 1964m 1.4g 149m R 59.0 17.7   1:46.77 php
4856 www-data  17   0 2054m 1.6g 148m R 31.9 17.5   1:59.90 php
4846 www-data  18   0 1316m 1.1g 148m R 26.1 14.8   1:16.63 php
4866 www-data  15   0  153m  14m 149m S  5.5  0.2   0:15.51 php
4788 www-data  15   0  155m  16m 152m S  4.5  0.2   0:11.37 php
4809 www-data  16   0  154m  15m 149m S  4.5  0.2   0:11.07 php
4890 www-data  15   0  153m  13m 148m R  3.5  0.2   0:11.96 php
4870 www-data  16   0  153m  15m 148m S  2.6  0.2   0:12.22 php
7126 www-data  15   0  153m  14m 148m S  2.3  0.2   0:10.43 php
4945 www-data  15   0  152m  13m 148m S  1.9  0.2   0:13.35 php
4986 www-data  15   0  153m  14m 149m S  1.6  0.2   0:14.95 php
4823 www-data  15   0  152m  13m 148m S  1.3  0.2   0:14.64 php
4829 www-data  15   0  153m  13m 149m S  1.3  0.2   0:13.09 php
4879 www-data  15   0  153m  14m 148m S  1.3  0.2   0:17.27 php

strace -p pid shows only next:
mremap(0x2a9f3fa000, 1812733952, 1812733952, MREMAP_MAYMOVE) =
0x2a9f3fa000



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-04 05:09 UTC] madcamel at gmail dot com
I've ran into this too. 

PHP can behave very badly under FastCGI, especially 4.x. Some scripts just do not exit, and hang in a tight loop consuming massive amounts of resources.

I know this isn't a real fix, but when I became more careful with my coding style and changed some timeouts the problem went away.

Take a good close look at what you are running(xdebug helps), and try lowering some of the timeout values in php. Make sure database handles are closed properly and if applicable, make sure you are using the latest version of the mysql libraries. I've had them leak pretty badly at times.
 [2008-07-11 21:28 UTC] jani@php.net
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6
ready.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC