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

Loïc Hoguin essen at ninenines.eu
Fri Mar 14 20:11:27 CET 2014


Yep, only once. All functions that return {ok, ...} are like this. 
There's no right approach, that's left as an exercise to the developer. :-)

You can probably use cowboy_req:set_meta/meta if you really need to pass 
it around.

On 03/14/2014 08:07 PM, Phillips, Christopher wrote:
>    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
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the Extend mailing list