Project

General

Profile

Actions

Bug #1857

closed

spawn-fcgi periodically hangs serving php

Added by checkers over 15 years ago. Updated over 15 years ago.

Status:
Invalid
Priority:
Normal
Category:
spawn-fcgi
Target version:
-
ASK QUESTIONS IN Forums:

Description

I was testing spawn-fcgi on a new machine with nginx and discovered that it seemingly hangs after a few hours.

Here's a little debugging output. If I can do further testing let me know. BTW, the init.d script just runs this line:
/usr/bin/spawn-fcgi -s /tmp/nginx-php-fastcgi.sock -f php-cgi -u www-data -g www-data -C 2 -P /var/run/nginx-php-fastcgi.pid
I installed spawn-fcgi by installing lighttpd package (on debian lenny) and then copying the binary before purging lighttpd package.

abraxo:~# ps auwx | grep php
www-data  6535  0.0  1.4  25848  5164 ?        Ss   08:22   0:00 php-cgi
www-data 14158  0.0  4.5  36216 16436 ?        S    11:21   0:21 php-cgi
www-data 17347  0.0  4.2  35264 15268 ?        S    13:00   0:10 php-cgi
root     27166  0.0  0.1   3000   680 pts/1    R+   19:23   0:00 grep php

abraxo:~# ps auwx | grep nginx
root      1666  0.0  0.2   4648   740 ?        Ss   05:43   0:00 nginx: master process /usr/sbin/nginx
www-data  1667  0.0  0.4   5000  1628 ?        S    05:43   0:02 nginx: worker process
www-data  1668  0.0  0.4   5004  1640 ?        S    05:43   0:02 nginx: worker process
www-data  1669  0.0  0.4   5016  1640 ?        S    05:43   0:03 nginx: worker process
www-data  1670  0.0  0.4   5000  1644 ?        S    05:43   0:03 nginx: worker process
root     27173  0.0  0.1   3000   676 pts/1    R+   19:24   0:00 grep nginx

abraxo:~# strace -p 6535
Process 6535 attached - interrupt to quit
wait4(-1, ^C <unfinished ...>
Process 6535 detached
abraxo:~# strace -p 14158
Process 14158 attached - interrupt to quit
semop(0, 0xbface5b2, 1^C <unfinished ...>
Process 14158 detached
abraxo:~# strace -p 17347
Process 17347 attached - interrupt to quit
semop(0, 0xbfacd4a2, 1^C <unfinished ...>
Process 17347 detached

abraxo:~# strace -p 1666
Process 1666 attached - interrupt to quit
rt_sigsuspend([]^C <unfinished ...>
Process 1666 detached
abraxo:~# strace -p 1667
Process 1667 attached - interrupt to quit
gettimeofday({1230078287, 347085}, NULL) = 0
epoll_wait(8, {{EPOLLIN|EPOLLERR|EPOLLHUP, {u32=166154268, u64=13815877521778364444}}}, 512, 8873) = 1
gettimeofday({1230078288, 563134}, NULL) = 0
recv(14, 0x9e7def8, 1024, 0)            = -1 ECONNRESET (Connection reset by peer)
close(14)                               = 0
epoll_wait(8, {{EPOLLIN|EPOLLOUT, {u32=166154520, u64=166154520}}}, 512, 7657) = 1
gettimeofday({1230078291, 59488}, NULL) = 0
recv(12, "GET /wiki/Main_Page HTTP/1.1\r\nHos"..., 1024, 0) = 432
socket(PF_FILE, SOCK_STREAM, 0)         = 13
ioctl(13, FIONBIO, [1])                 = 0
epoll_ctl(8, EPOLL_CTL_ADD, 13, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=166154269, u64=713136060756348957}}) = 0
connect(13, {sa_family=AF_FILE, path="/tmp/nginx-php-fastcgi.sock"...}, 110) = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(8, {{EPOLLOUT|EPOLLHUP, {u32=166154269, u64=713136060756348957}}}, 512, 5161) = 1
gettimeofday({1230078291, 60438}, NULL) = 0
getsockopt(13, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
writev(13, [{"\1\1\0\1\0\10\0\0\0\1\0\0\0\0\0\0\1\4\0\1\3e\3\0\f\nQUERY_S"..., 912}], 1) = -1 ENOTCONN (Transport endpoint is not connected)
write(11, "2008/12/23 19:24:51 [error] 1667#"..., 320) = 320
close(13)                               = 0
writev(12, [{"HTTP/1.1 502 Bad Gateway\r\nServer:"..., 181}, {"<html>\r\n<head><title>502 Bad Gate"..., 120}, {"<hr><center>nginx/0.6.32</center>"..., 53}], 3) = 354
write(3, "203.59.102.239 - - [23/Dec/2008:1"..., 199) = 199
recv(12, 0x9e7d5e0, 1024, 0)            = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(8, {{EPOLLIN|EPOLLERR|EPOLLHUP, {u32=166154100, u64=13815877521778364276}}}, 512, 5160) = 1
gettimeofday({1230078292, 271542}, NULL) = 0
recv(15, 0x9e7e708, 1024, 0)            = -1 ECONNRESET (Connection reset by peer)
close(15)                               = 0
epoll_wait(8, ^C <unfinished ...>
Process 1667 detached

abraxo:~# ls -alh /tmp/nginx-php-fastcgi.sock
srwxr-xr-x 1 www-data www-data 0 2008-12-23 08:22 /tmp/nginx-php-fastcgi.sock

abraxo:~# killall -9 php-cgi
abraxo:~# /etc/init.d/php-fastcgi start
spawn-fcgi.c.197: child spawned successfully: PID: 27302
abraxo:~#
Actions #1

Updated by hoffie over 15 years ago

  • Status changed from New to Invalid

checkers wrote:

I was testing spawn-fcgi on a new machine with nginx and discovered that it seemingly hangs after a few hours.

What makes you think that spawn-fcgi hangs? After having read your debugging output I'm rather confident that you are hitting a PHP problem. spawn-fcgi is just a tiny helper binary which sets up the environment and then replaces itself by the actual application (PHP) in this case. So once spawn-fcgi has successfully spawned php, its job is done and the bug is somewhere else.

abraxo:~# ps auwx | grep php
www-data 6535 0.0 1.4 25848 5164 ? Ss 08:22 0:00 php-cgi

abraxo:~# strace -p 6535
Process 6535 attached - interrupt to quit
wait4(-1, ^C <unfinished ...>
Process 6535 detached

This looks normal. This is the watcher process which just becomes active if it sees changes from its children.

abraxo:~# strace -p 14158

Process 14158 attached - interrupt to quit

semop(0, 0xbface5b2, 1^C <unfinished ...>

Process 14158 detached

This is probably the hang you are seeing, yep. So.. a PHP bug :)

Actions #2

Updated by stbuehler over 15 years ago

  • Priority changed from High to Normal

I guess php is just overloaded, but could be a php bug as well.

and btw: i really don't like people setting "priority: high" without a good reason. and preview is a nice thing :)

Actions #3

Updated by checkers over 15 years ago

Apologies for the misreport. Thanks for your pointers, I'll look further.

stbuehler wrote:

and btw: i really don't like people setting "priority: high" without a good reason. and preview is a nice thing :)

My bad.. twice!

Actions

Also available in: Atom