fastcgi problems (connection hangs/time outs)
Attila Nagy
bra at fsn.hu
Tue Oct 9 14:23:45 MSD 2007
Hello,
I have a very simple perl fastcgi application (just for testing) and
nginx 0.5.32 and 0.6.13.
With both versions I get nothing in the web browser and the log says
that there is a timeout.
ktrace of the nginx process: (the first read is from the fcgi program,
via localhost/TCP, same with unix socket)
91364 nginx 1191924703.034159 CALL recvfrom(0xa,0x80fa000,0x1000,0,0,0)
91364 nginx 1191924703.034195 GIO fd 10 read 85 bytes
0x0000 0106 0001 0035 0000 436f 6e74 656e 742d |.....5..Content-|
0x0010 7479 7065 3a20 7465 7874 2f68 746d 6c0d |type: text/html.|
0x0020 0a43 6f6e 7465 6e74 2d6c 656e 6774 683a |.Content-length:|
0x0030 2035 0d0a 0d0a 6865 6c6c 6f0d 0a01 0600 | 5....hello.....|
0x0040 0100 0000 0001 0300 0100 0800 0000 0000 |................|
0x0050 0000 0000 00 |.....|
91364 nginx 1191924703.034199 RET recvfrom 85/0x55
91364 nginx 1191924703.034229 CALL
kevent(0x9,0x80b4000,0,0x80c4000,0x200,0xbfbfea60)
91364 nginx 1191924763.022580 RET kevent 0
91364 nginx 1191924763.022613 CALL gettimeofday(0xbfbfe9b8,0)
91364 nginx 1191924763.022616 RET gettimeofday 0
91364 nginx 1191924763.022634 CALL
kevent(0x9,0x80b4000,0,0x80c4000,0x200,0xbfbfea60)
91364 nginx 1191924763.032573 RET kevent 0
91364 nginx 1191924763.032583 CALL gettimeofday(0xbfbfe9b8,0)
91364 nginx 1191924763.032585 RET gettimeofday 0
91364 nginx 1191924763.032613 CALL write(0x4,0xbfbfe1e0,0xe6)
91364 nginx 1191924763.032635 GIO fd 4 wrote 230 bytes
"2007/10/09 12:12:43 [error] 91364#0: *1 upstream timed out (60:
Operat\
ion timed out) while reading upstream, client: 172.16.129.150,
server:\
localhost, URL: "/", upstream: "fastcgi://127.0.0.1:1026",
host: "jap\
an.asdfghj.private"
"
91364 nginx 1191924763.032639 RET write 230/0xe6
91364 nginx 1191924763.033010 CALL close(0xa)
91364 nginx 1191924763.033588 RET close 0
I've also tried the same program with lighttpd and there everything
works fine:
90925 lighttpd GIO fd 8 read 85 bytes
0x0000 0106 0001 0035 0000 436f 6e74 656e 742d |.....5..Content-|
0x0010 7479 7065 3a20 7465 7874 2f68 746d 6c0d |type: text/html.|
0x0020 0a43 6f6e 7465 6e74 2d6c 656e 6774 683a |.Content-length:|
0x0030 2035 0d0a 0d0a 6865 6c6c 6f0d 0a01 0600 | 5....hello.....|
0x0040 0100 0000 0001 0300 0100 0800 0000 0000 |................|
0x0050 0000 0000 00 |.....|
90925 lighttpd RET read 85/0x55
90925 lighttpd CALL kevent(0x6,0xbfbfe930,0x1,0,0,0xbfbfe928)
90925 lighttpd RET kevent 0
90925 lighttpd CALL close(0x8)
90925 lighttpd RET close 0
[...]
the above little page gets served to the browser.
nginx config:
worker_processes 1;
error_log /tmp/nginx.log debug;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:1026;
fastcgi_param SCRIPT_FILENAME
/scripts$fastcgi_script_name;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
}
And the program, which serves the fastcgi response:
use FCGI::Async;
use IO::Async::Set::IO_Poll;
my $fcgi = FCGI::Async->new(
port => 1026,
on_request => sub {
my ($fcgi, $req) = @_;
my $page = "hello";
$req->print_stdout(
"Content-type: text/html\r\n".
"Content-length: ".length($page)."\r\n".
"\r\n".
$page."\r\n"
);
$req->finish();
}
);
my $set = IO::Async::Set::IO_Poll->new();
$set->add($fcgi);
$set->loop_forever;
(but I've tried with a completely different stuff,
POE::Component::FastCGI and the effect is the same)
Any ideas?
ps: please keep me on CC.
Thanks,
--
Attila Nagy e-mail: Attila.Nagy at fsn.hu
Free Software Network (FSN.HU) phone: +3630 306 6758
http://www.fsn.hu/
More information about the nginx
mailing list