Gregory Collins | 5 Apr 11:05 2012

Re: thread killed

+haskell-cafe, oops

On Thu, Apr 5, 2012 at 11:04 AM, Gregory Collins <greg <at>> wrote:
On Wed, Apr 4, 2012 at 10:09 PM, tsuraan <tsuraan <at>> wrote:
> It's hard to rule Snap timeouts out; try building snap-core with the
> "-fdebug" flag and running your app with "DEBUG=1", you'll get a spew of
> debugging output from Snap on stderr.

Heh, that was quite a spew.  I normally get the exceptions tens of MB
into files that are hundreds of MB, and I sometimes don't get them at
all, so printing out the entire request body was a bit slow :)  After
commenting out some of the more talkative debug statements, I got the
exception to happen, and it looks generally like this:

I think I might know what your problem is. You're accepting file uploads using handleMultipart, yes? Snap kills uploads that are going too slow, otherwise you would be vulnerable to slowloris ( DoS attacks. What's probably happening here is that you're doing slow work inside the "Iteratee IO a" handler you pass to that function, which makes Snap think the client is trickling bytes to you. If that's the case, either finish the iteratee more quickly and do the slow work back in the Snap handler (preferable), or disable the minimum upload rate guard (although that's not recommended on a server talking to the public internet.)

Gregory Collins <greg <at>>

Gregory Collins <greg <at>>
Haskell-Cafe mailing list
Haskell-Cafe <at>