Hello, I have 4 web servers with lighttpd to serve one web site with DNS load sharing. On the 2 SMP-enable web servers, there will be many php-cgi frozen in 'sbwait' state every day. It means the php-cgi stay in 'sbwait' state, and never be back to 'accept' or other state. If I restart them, there will be frozen php-cgi appear some hours later. There is no problem on the other single CPU web servers which running same php scripts and same configuration and version of PHP. Why and any solution? Thanks! Regards, Ken
Ken Chen wrote:> Hello, > > I have 4 web servers with lighttpd to serve one web site with DNS load > sharing. On the 2 SMP-enable web servers, there will be many php-cgi frozen > in 'sbwait' state every day. It means the php-cgi stay in 'sbwait' state, > and never be back to 'accept' or other state. If I restart them, there will > be frozen php-cgi appear some hours later.You didn't give any information about your environment, specifically versions of FreeBSD, PHP and lighttpd you use, and in what way you use PHP (I'm guessing you're using FastCGI).> There is no problem on the other single CPU web servers which running same > php scripts and same configuration and version of PHP. > > Why and any solution?AFAIK sbwait is socket buffer wait, meaning the process is waiting for some data over a socket (and, in your case, it's not getting it). I'm using php-cgi in FastCGI mode (with mod_fcgid on Apache) on about a dozen servers, all SMP, without problems. Some Apaches are worker-threaded and some use the event MPM. It very much looks like your problem could be a bug in lighttpd. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20081107/13e71f0f/signature.pgp
Oh.. sorry, I forgot to provide the information of my environment. web4# php-cgi -v PHP 5.2.6 (cgi-fcgi) (built: Nov 2 2008 11:16:30) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies with XCache v1.2.2, Copyright (c) 2005-2007, by mOo web4# /usr/local/lighttpd/sbin/lighttpd -v lighttpd-1.4.19 - a light and fast webserver Build-Date: Sep 1 2008 16:58:51 web4# uname -a FreeBSD web4.xxxx.com 7.0-RELEASE-p5 FreeBSD 7.0-RELEASE-p5 #11: Mon Nov 3 01:10:36 CST 2008 root@web4.xxxx.com:/usr/obj/usr/src/sys/WEB4 i386 web4# ps alx | grep php-cgi | grep -v grep | grep sbwait 65534 57776 47240 0 4 0 182328 84984 sbwait I ?? 2:02.12 /usr/local/bin/php-cgi 65534 57801 47240 0 4 0 182328 82408 sbwait I ?? 0:19.97 /usr/local/bin/php-cgi 65534 57809 47240 0 4 0 182328 84096 sbwait I ?? 1:12.03 /usr/local/bin/php-cgi 65534 57823 47240 0 4 0 182328 84492 sbwait I ?? 2:04.21 /usr/local/bin/php-cgi 65534 57833 47240 0 4 0 183352 83316 sbwait I ?? 0:28.62 /usr/local/bin/php-cgi 65534 57866 47240 0 4 0 182328 79952 sbwait I ?? 0:05.92 /usr/local/bin/php-cgi 65534 57870 47240 0 4 0 182328 83184 sbwait I ?? 0:56.83 /usr/local/bin/php-cgi 65534 57871 47240 0 4 0 182328 83388 sbwait I ?? 0:54.96 /usr/local/bin/php-cgi 65534 57891 47240 0 4 0 182328 84436 sbwait I ?? 1:58.32 /usr/local/bin/php-cgi 65534 57925 47240 0 4 0 182328 84380 sbwait I ?? 2:03.53 /usr/local/bin/php-cgi 65534 65944 47240 0 4 0 182328 84184 sbwait I ?? 0:39.97 /usr/local/bin/php-cgi 65534 65952 47240 0 4 0 182328 84408 sbwait I ?? 0:21.37 /usr/local/bin/php-cgi
On Fri, Nov 07, 2008 at 07:29:37PM +0800, Ken Chen wrote:> Hello, > > I have 4 web servers with lighttpd to serve one web site with DNS load > sharing. On the 2 SMP-enable web servers, there will be many php-cgi frozen > in 'sbwait' state every day. It means the php-cgi stay in 'sbwait' state, > and never be back to 'accept' or other state. If I restart them, there will > be frozen php-cgi appear some hours later. > > There is no problem on the other single CPU web servers which running same > php scripts and same configuration and version of PHP. > > Why and any solution?I'm not understanding what the problem is (and I've seen the output you provided later in the thread). Are you stating the problem is that you see many php-cgi processes? Or are you worried they're not doing anything? Does the website function, lock up, or anything like that? If not, what's the issue? :-) -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
I think the parent php-cgi are very health. I have tried: There are total 49 php-cgi processes are running or frozen, the '1 wait' is parent . web4# ps alx | grep php-cgi | grep -v grep | awk '{print $9}' | sort | uniq -c | sort -n 1 biowr 1 wait 15 sbwait 32 accept Kill one of frozen php-cgi processes. web4# kill -9 61392 Check again the amount of php-cgi processes, there are still 49 php-cgi procerss. web4# ps alx | grep php-cgi | grep -v grep | awk '{print $9}' | sort | uniq -c | sort -n 1 biord 1 bo_wwa 1 wait 4 - 17 sbwait 25 accept 2008/11/10 Anton - Valqk <lists@lozenetz.org>> Oh, just saw that, this could be caused by dead parent php-cgi processes > (just a guess). > I used to run lighttpd with span-fcgi executable and it happens very > often to have dead parents (of php-cgi childs) that must be killed by > killall php-cgi (eg. restart _ALL_ php-cgi processes, pretty stupid!!! > but if you have dead parent you can't know which childs to kill)... > If you run your php-cgi processes just from the lighttpd(and lighttpd > manages php-cgi processes) try running it with fcgi-spawn and write a > script to check parents of the php-cgi backends and you'll see if that's > the cause of having 'hang' phps :( > > pls tell me what is it. I'm interested! > > cheers, > valqk. > Ken Chen wrote: > > Hi Jeremy, > > > > A health FastCGI process have a lifetime, so the PIDs of all php-cgi > > processes should in a short range. > > > > There are some 'php-cgi' fall in 'sbwait' state, and stay there forever. > The > > frozen 'php-cgi' can't accept new request, so never retire. > > > > Please forgive my poor English. > > > > 2008/11/7 Jeremy Chadwick <koitsu@freebsd.org> > > > > > >> On Fri, Nov 07, 2008 at 07:29:37PM +0800, Ken Chen wrote: > >> > >>> Hello, > >>> > >>> I have 4 web servers with lighttpd to serve one web site with DNS load > >>> sharing. On the 2 SMP-enable web servers, there will be many php-cgi > >>> > >> frozen > >> > >>> in 'sbwait' state every day. It means the php-cgi stay in 'sbwait' > state, > >>> and never be back to 'accept' or other state. If I restart them, there > >>> > >> will > >> > >>> be frozen php-cgi appear some hours later. > >>> > >>> There is no problem on the other single CPU web servers which running > >>> > >> same > >> > >>> php scripts and same configuration and version of PHP. > >>> > >>> Why and any solution? > >>> > >> I'm not understanding what the problem is (and I've seen the output you > >> provided later in the thread). Are you stating the problem is that you > >> see many php-cgi processes? Or are you worried they're not doing > >> anything? Does the website function, lock up, or anything like that? > >> If not, what's the issue? :-) > >> > >> -- > >> | Jeremy Chadwick jdc at parodius.com | > >> | Parodius Networking http://www.parodius.com/ | > >> | UNIX Systems Administrator Mountain View, CA, USA | > >> | Making life hard for others since 1977. PGP: 4BD6C0CB | > >> > >> > >> > > _______________________________________________ > > freebsd-stable@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org > " > > > > > >
Ken Chen wrote:> Change to configuration to solve this problem: > > #server.network-backend = "freebsd-sendfile" > server.network-backend = "writev" > > http://redmine.lighttpd.net/boards/2/topics/show/141Good to know. Please consider posting a PR. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20081125/15dbcff7/signature.pgp
On Tue, Nov 25, 2008 at 6:40 AM, Ken Chen <ken73.chen@gmail.com> wrote:> Change to configuration to solve this problem: > > #server.network-backend = "freebsd-sendfile" > server.network-backend = "writev" > > http://redmine.lighttpd.net/boards/2/topics/show/141Maybe this patch is related? http://redmine.lighttpd.net/issues/show/1813 Scott