librelist archives

« back to archive

Error when getting a large POST request

Error when getting a large POST request

From:
Loic d'Anterroches
Date:
2010-11-06 @ 14:59
Hello,

First, thanks a lot for Mongrel2, really, really nice.

My problem in short, Mongrel2 fails randomly when uploading (using 
Firefox and Curl) a file larger than 300kB. I have tried with 2 
different handlers (PHP and Python).

Mongrel2 gives this error:

  [ERROR] (src/io.c:343: errno: Resource temporarily unavailable) Too 
many retries (0) while reading.
  [ERROR] (src/connection.c:209: errno: None) Client closed the 
connection during upload.

The handlers are the example handlers in Python and PHP.

Mongrel2 version 1.4. (1.4-561cb4b4a4)
Zeromq version 2.0.8 (Python and PHP tested) and 2.0.10 (PHP tested).

I created a simple client/server test in PHP to check if the problem was 
from zeromq but I was able to transfer 20MB without issues.

My Mongrel2 conf:

handler_test = Handler(send_spec='tcp://127.0.0.1:9997',
                        send_ident='34f9ceee-cd52-4b7f-b197-88bf2f0ec378',
                        recv_spec='tcp://127.0.0.1:9996', recv_ident='')

main = Server(
     uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
     access_log="/logs/access.log",
     error_log="/logs/error.log",
     chroot="./",
     default_host="localhost",
     name="test",
     pid_file="/run/mongrel2.pid",
     port=6767,
     hosts = [
         Host(name="localhost", routes={
             '/tests/': Dir(base='tests/', index_file='index.html',
                              default_ctype='text/plain'),
             '/handlertest': handler_test
         })
     ]
)
settings = { "limits.content_length": 20971520,
	     "limits.buffer_size": 49152,
	     "limits.handler_stack": 2097152,
	     "upload.temp_store": "/tmp/mongrel2.upload.XXXXXX" }
servers = [main]

I tried to play with the handler_stack/buffer_size values without real 
success.

When I put the content_length to something low, I get 3 hits on my 
handler with an upload, with the "Done" info performed 2 times. This 
reproduces ticket: http://mongrel2.org/tktview?name=c64bb4ac0d

So, at the moment, I am looking for a workaround, if someone has one, I 
would happily take it.

Thanks,
loïc



Re: [mongrel2] Error when getting a large POST request

From:
Zed A. Shaw
Date:
2010-11-06 @ 18:10
On Sat, Nov 06, 2010 at 03:59:05PM +0100, Loic d'Anterroches wrote:
> Hello,
> 
> First, thanks a lot for Mongrel2, really, really nice.
> 
> My problem in short, Mongrel2 fails randomly when uploading (using 
> Firefox and Curl) a file larger than 300kB. I have tried with 2 
> different handlers (PHP and Python).

Hmm, well it does expect the client to keep the connection open, not
close it right away.  That log error says that the client is closing the
connection right after the upload.

I've gotta do some of this today so I'll hop in and try it myself.  Can
you put up a ticket, and try to include some steps to reproduce with say
curl so I can try it out?  I'll fix it today for sure if I can make it
fail too.

> When I put the content_length to something low, I get 3 hits on my 
> handler with an upload, with the "Done" info performed 2 times. This 
> reproduces ticket: http://mongrel2.org/tktview?name=c64bb4ac0d

Ah alright I'll try it out today and fix it up.

> So, at the moment, I am looking for a workaround, if someone has one, I 
> would happily take it.

Well, I guess you'll have to wait until I get it fixed, but shouldn't be
long.  I think I know what's causing it.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Error when getting a large POST request

From:
Loic d'Anterroches
Date:
2010-11-06 @ 19:55
Hello,

thanks a lot for the quick answer. Here is the ticket I opened:
http://mongrel2.org/info/61091d0a45

thanks,
loïc

On 2010-11-06 19:10, Zed A. Shaw wrote:
> On Sat, Nov 06, 2010 at 03:59:05PM +0100, Loic d'Anterroches wrote:
>> Hello,
>>
>> First, thanks a lot for Mongrel2, really, really nice.
>>
>> My problem in short, Mongrel2 fails randomly when uploading (using
>> Firefox and Curl) a file larger than 300kB. I have tried with 2
>> different handlers (PHP and Python).
>
> Hmm, well it does expect the client to keep the connection open, not
> close it right away.  That log error says that the client is closing the
> connection right after the upload.
>
> I've gotta do some of this today so I'll hop in and try it myself.  Can
> you put up a ticket, and try to include some steps to reproduce with say
> curl so I can try it out?  I'll fix it today for sure if I can make it
> fail too.
>
>> When I put the content_length to something low, I get 3 hits on my
>> handler with an upload, with the "Done" info performed 2 times. This
>> reproduces ticket: http://mongrel2.org/tktview?name=c64bb4ac0d
>
> Ah alright I'll try it out today and fix it up.
>
>> So, at the moment, I am looking for a workaround, if someone has one, I
>> would happily take it.
>
> Well, I guess you'll have to wait until I get it fixed, but shouldn't be
> long.  I think I know what's causing it.
>

-- 
Dr Loïc d'Anterroches
Founder Céondo Ltd

w: www.ceondo.com       |  e: loic@ceondo.com
t: +44 (0)207 183 0016  |  f: +44 (0)207 183 0124

Céondo Ltd
Dalton House
60 Windsor Avenue
London
SW19 2RR / United Kingdom

Re: [mongrel2] Error when getting a large POST request

From:
Zed A. Shaw
Date:
2010-11-06 @ 20:41
On Sat, Nov 06, 2010 at 08:55:16PM +0100, Loic d'Anterroches wrote:
> Hello,
> 
> thanks a lot for the quick answer. Here is the ticket I opened:
> http://mongrel2.org/info/61091d0a45

Cool, let me take a look and see what I see.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] Error when getting a large POST request

From:
Loic d'Anterroches
Date:
2010-11-07 @ 07:17

On 2010-11-06 21:41, Zed A. Shaw wrote:
> On Sat, Nov 06, 2010 at 08:55:16PM +0100, Loic d'Anterroches wrote:
>> Hello,
>>
>> thanks a lot for the quick answer. Here is the ticket I opened:
>> http://mongrel2.org/info/61091d0a45
>
> Cool, let me take a look and see what I see.

Thanks, meanwhile I will continue to work with small files. Just 
experimenting with a PHP web framework for Mongrel2 or anybody being 
able to speak the Mongrel2 protocol (which is really nice, I can get 
some business daemons to speak this protocol to reuse code).

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Pluf - High performance PHP5 framework - http://pluf.org
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com