ID:               44749
 User updated by:  eth at ethaniel dot com
 Reported By:      eth at ethaniel dot com
 Status:           Open
 Bug Type:         CGI related
 Operating System: Freebsd 7.0
 PHP Version:      5.2.5
 New Comment:

Seems like the problem was in lighttpd.

Setting server.network-backend = "write" in lighttpd.conf solved the
problem.


Previous Comments:
------------------------------------------------------------------------

[2008-04-16 21:31:05] eth at ethaniel dot com

Description:
------------
I use Freebsd 7.0 with lighttpd 1.4.19 and php-cgi 5.2.5 (with suhosin
patch).

I noticed, that when I do a large upload (1.2 megabytes) php works
unadequately: randomly it either corrupts the upload or just freezes.

So for instance, if I run php-cgi on a tcp port (1026) it successfully
accepts all uploads that are given to it from lighttpd and processes
them through the script. But randomly (sometimes several times in a row,
sometimes one out of 10 requests) it corrupts the post data (several
bytes in the center of the 1.2 megabyte block get corrupted - replaced
with 00 00 00 hex values). Nothing freezes at this configuration.

If I run php-cgi as a unix socket (/tmp/php.sock) it either accepts the
upload (and never shows any sign of corruption, all data is processed
normally), or just halts and leaves the connection open (doesn't reply
to the current and any new connections either).
Sometimes it just unfreezes after a while and starts accepting new
connections, sometimes I just have to respawn php-cgi.

My best guess is that it might have something to do with the freebsd
7.0 socket handling. Maybe not - maybe it really is a bug in php-cgi.

I checked - lighttpd has all the uploaded files uncorrupted. The bad
things start happening somewhere between lighttpd and fastcgi php.

Reproduce code:
---------------
Here is the command I use to make the upload from the remote host.

curl -vv -# -s -F "[EMAIL PROTECTED]" -H "Host: upload.host.ru" -H
"Expect:" -H "Content-Type:" -0 1.1.1.1:200/testupload.php

Note the empty Content-type - once I noticed the corruption, I decided
to make a test and debug HTTP_RAW_POST_DATA by hand. The corruption was
all the way up there.

Expected result:
----------------
The testupload.php script checks the HTTP_RAW_POST_DATA, extracts the
uploaded files from mime headers and checks it's md5 value. If MD5 is
incorrect, it logs the uploaded file and then I compare it to the normal
sample.

Actual result:
--------------
Nothing here.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44749&edit=1

Reply via email to