From:             eth at ethaniel dot com
Operating system: Freebsd 7.0
PHP version:      5.2.5
PHP Bug Type:     CGI related
Bug description:  FastCGI problems during large HTTP Posts (corruption or hang)

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 bug report at http://bugs.php.net/?id=44749&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44749&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44749&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44749&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44749&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44749&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44749&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44749&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44749&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44749&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44749&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44749&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44749&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44749&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44749&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44749&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44749&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44749&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44749&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44749&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44749&r=mysqlcfg

Reply via email to