weird behavior - race condition ?

Matthieu Tourne matthieu.tourne at gmail.com
Sun Mar 27 12:30:14 MSD 2011


Hi all,

I just found a weird behavior in nginx, which looks like a race condition.

I'm using an unmodified nginx 0.9.6 with no option on the ./configure line
and the config is pretty much the default except for those 2 directives in
the http section :

client_max_body_size  20M;
client_body_in_single_buffer on;


I have the "location ~ \.php$" enabled and a simple script called
print_post.php which contains :
<?php print_r($_POST); ?>

let's curl it to see if this works :
curl 'http://localhost/print_post.php' -F 'file=@/path/to/15M_file' -F
'foo=bar'

it shows as you would expect :
Array
(
    [foo] => bar
)

now let's use HTTP 1.0 (with the -0 option for curl):
curl 'http://localhost/print_post.php' -F 'file=@/path/to/15M_file' -F
'foo=bar' -0
sometimes I get the expected result, and some other times just an empty
array :
Array
(
)

strangely this doesn't seem to occur with HTTP 1.1, and seems to go away if
I don't use "client_body_in_single_buffer on;"

can anybody reproduce this ?

Thank you,
Matthieu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110327/535f7f4b/attachment.html>


More information about the nginx mailing list