Project

General

Profile

[Solved] lighttpd blocks while reading data POSTed to CGI script

Added by davidm over 14 years ago

Hi,

I'm using lighttpd on an embedded ARM board running buildroot:

$ lighttpd -v
lighttpd-1.4.20 (ssl) - a light and fast webserver
Build-Date: Feb 16 2009 21:56:18

The problem I'm seeing is that when I try to upload a file via POST, lighttpd fails to answer any other request while the upload is in progress. In case it matters, the data is POSTed to a CGI script (/usr/lib/cgi-bin/foo). I can work around the problem by setting "server.max-worker = 2", but I don't think that should be necessary. I suspect I'm missing something very basic. Config file is attached.

Can someone explain what is going wrong and what I should do to fix it?

Thanks!

--david

Replies (4)

RE: lighttpd blocks while reading data POSTed to CGI script - Added by davidm over 14 years ago

The problem appears to come from the fact that writes to the CGI process are done in a blocking fashion. In my case, the CGI process consuming the data is rather slow so the write() blocks a lot and for long periods of time. I can work around the problem by buffering the POST data in the CGI process. Not ideal, since it would be better to stream the data rather than having to buffer it multiple times, but at least it works around the immediate problem.

Are there any plans to fix this issue in future lighttpd releases (I tried 1.4.23 with the same result).

RE: lighttpd blocks while reading data POSTed to CGI script - Added by Anonymous over 10 years ago

Hi all,

i am facing the very same issue:
I POST a 15MB file, while uploading i need some feedbacks about the status, but server doesen't answer at all, except than at the end of the upload.

Would be nice from someone i the lighty team to enlight us on this.
Maybe the impossibility ti handle multiple cgi requests it's a feature.
Is the "server.max-worker = 2" acceptable ?
Coud fastcgi be a solution ?

Thanks

RE: lighttpd blocks while reading data POSTed to CGI script - Added by stbuehler over 10 years ago

yes, 1.4.x mod_cgi blocks on writing POST data to CGI (not on reading response, only on writing the request). Use mod_fastcgi (or mod_scgi/mod_proxy) instead to avoid this (see fcgi-cgi if you need a wrapper).

RE: lighttpd blocks while reading data POSTed to CGI script - Added by gstrauss over 7 years ago

FYI: this is fixed in lighttpd git master and the fix will be part of the upcoming lighttpd 1.4.40 release.

    (1-4/4)