FastCGI backend issue

I’ve got a self-written FastCGI backend. It works with Lighttpd, but not
with Nginx. Nginx connects to the backend, sends the request, receives
the response, but then appears to wait on something else.

The backend writes one or more FCGI_STDOUT packets and a
FCGI_END_REQUEST packet. Any hints on what’s wrong?

writev(10,
[{"\1\1\0\1\0\10\0\0\0\1\0\0\0\0\0\0\1\4\0\1\3\212\6\0\f\0QUERY_"…,
952}], 1) = 952
epoll_wait(8, {{EPOLLIN|EPOLLOUT, {u32=3285521105,
u64=139778701202129}}}, 512, 59998) = 1
recvfrom(10, “\1\6\0\1\2[\0\0Content-Type: text/html;”…, 4096, 0,
NULL, NULL) = 635
readv(10, 0x7fff5452b860, 1) = -1 EAGAIN (Resource temporarily
unavailable)
epoll_wait(8, {}, 512, 59962) = 0

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169360,169360#msg-169360

Hello!

On Tue, Jan 25, 2011 at 04:38:31AM -0500, Olaf van der Spek wrote:

I’ve got a self-written FastCGI backend. It works with Lighttpd, but not
with Nginx. Nginx connects to the backend, sends the request, receives
the response, but then appears to wait on something else.

The backend writes one or more FCGI_STDOUT packets and a
FCGI_END_REQUEST packet. Any hints on what’s wrong?

Most likely your backend doesn’t honor FCGI_KEEP_CONN flag.

Maxim D.

Maxim D. Wrote:

Most likely your backend doesn’t honor
FCGI_KEEP_CONN flag.

It doesn’t. Why does Nginx wait after FCGI_END_REQUEST though?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169360,169402#msg-169402

Hello!

On Tue, Jan 25, 2011 at 07:52:18AM -0500, Olaf van der Spek wrote:

Maxim D. Wrote:

Most likely your backend doesn’t honor
FCGI_KEEP_CONN flag.

It doesn’t. Why does Nginx wait after FCGI_END_REQUEST though?

nginx doesn’t process data from fastcgi app untill buffer filled or
connection closed by app (as required per spec without
FCGI_KEEP_CONN flag set).

I’ve posted some patches which change things as part of keepalive
with backends work, but most likely you don’t want to rely on
them. You may want to make your app actually fastcgi complaint
instead.

Maxim D.

nginx doesn’t process data from fastcgi app untill
buffer filled or
connection closed by app (as required per spec
without
FCGI_KEEP_CONN flag set).

What part of the spec requires the webserver to wait until the
connection is closed by the backend?
Doesn’t Nginx support (and use) persistent connections?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169360,169414#msg-169414

Hello!

On Tue, Jan 25, 2011 at 08:41:29AM -0500, Olaf van der Spek wrote:

nginx doesn’t process data from fastcgi app untill
buffer filled or
connection closed by app (as required per spec
without
FCGI_KEEP_CONN flag set).

What part of the spec requires the webserver to wait until the
connection is closed by the backend?

Spec requires app to close connection if no FCGI_KEEP_CONN flag
set.

Doesn’t Nginx support (and use) persistent connections?

No.

Maxim D.

Somebody?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169360,172224#msg-172224

I’ve posted some patches which change things as
part of keepalive
with backends work, but most likely you don’t want
to rely on
them. You may want to make your app actually

Is there an bug/issue tracker that tracks this?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,169360,170181#msg-170181

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs