lighttpd 99% CPU when uploading file
When I upload something which is 9.5mb using PHP and
post_max_size = 8M
upload_max_filesize = 10M
then lighttpd uses 99% CPU and PHP and static content doesn't work.
If I change change post_max_size and make it 10M then everything is working as expected.
During the problem I notice that 1mb file chunks uploaded to /tmp and the hang starts when the file is fully uploaded (I sum the size of each temporary file). Also I use strace and during the hang no more data was passing strace.
Updated by stbuehler almost 12 years ago
Hm. I tried to reproduce it without success (PHP 5.2.6-3 with Suhosin-Patch 0.9.6.2) on linux (you are on freebsd iirc).
On my system, php reads the complete stdin stream, even if its bigger than post_max_size; i guess it just drops the content, as $_POST / $_FILES is empty. php does not send anything before stdin isn't read completely.
If this has changed, that would explain a little bit; mod_fastcgi does not read the response before it hasn't written all data.
Could you please try to attach to the hanging lighttpd with gdb and find out where it hangs? You will probably need debug symbols for this in lighttpd.
A strace from the php process may be nice too (use something like
strace spawn-fcgi -C 0 -p 1026 -n -- /usr/bin/php5-cgi
for "0" children, i.e. master process handles the request).
Btw: did you try the latest 1.4.20 prerelease? there was a freebsd-sendfile fix in r2256
Updated by Anonymous almost 12 years ago
The problem was finally with "freebsd-sendfile":
Also available in: Atom