# Weird behavior - race condition?

**URL:** <https://www.ruby-forum.com/t/weird-behavior-race-condition/205018>\
**Category:** NGINX\
**Created:** [March 27, 2011, 10:30am UTC](https://www.ruby-forum.com/t/weird-behavior-race-condition/205018 "2011-03-27T10:30:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 27, 2011, 10:30am UTC](https://www.ruby-forum.com/t/weird-behavior-race-condition/205018/1 "2011-03-27T10:30:59Z")

</div>

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](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](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.
