[99s-extend] Cowboy unexpectedly timing out when reading the body

Phillips, Christopher Christopher.Phillips at turner.com
Fri Mar 14 20:07:40 CET 2014


  This body is -small-. 48 bytes was my test data (per the
content-length). That shouldn't take 5 seconds to read, and usually it
took a millisecond or two, and returned to the client (despite actually
controlling some hardware across a network and such) within a second. And
it was ND; I tested this thing a couple of times locally and it appeared
to work, and even deployed onto a VM it worked some of the time (as I
said, might have been hardware or some other weirdness).

  So can we only read the body once? Or what's the right approach if I
want to access the body in both a module registered to the
onrequest/onresponse callbacks, and in the REST handler?

On 3/14/14, 2:56 PM, "Loïc Hoguin" <essen at ninenines.eu> wrote:

>Cowboy does have a timeout too small, that will be fixed soon (by making
>it configurable, per body-reading call). It will be in the next release.
>
>On the other hand there's something weird in what you said.
>
>On 03/14/2014 07:52 PM, Phillips, Christopher wrote:
>> first check the body with cowboy_req:body(Request) as part of an access
>> log, then ignore the returned cowboy_req:req() that call passed back,
>> since we could not then stream the body off of it again. It was working
>> fine, so I don't think it was related, but it seems more solid now after
>> I removed it and I don't know if that's related or not.
>
>If you ignore the Req being returned, especially after a body-reading
>call, then Cowboy will not be able to figure out that you actually read
>it, and will attempt to read it again to skip it, leading to issues.
>
>-- 
>Loïc Hoguin
>http://ninenines.eu




More information about the Extend mailing list