Monthly Archives: August 2013

Engineyard file timeouts

Symptoms:

  • So basically, the problem was that during long video uploads, the browser would suddenly through up a “error code: ERR_CONNECTION_RESET.”
  • The rails log was not showing anything unusual, even saying that it had sent a 200 (ok) response.  This was the most confusing part.

Problem:

So basically, the problem turned out to be that *something* was timing out the the form submission ahead of rails, so that rails couldn’t get a chance to send out an error code.  This was especially elusive because of problems we had had with the paperclip gem earlier this month.    After much trial and error trying to find a timeout setting that the server would care about, I finally found that it was actually looking for the “lingering_time” (the way I found this was that I timed the time-out, and then simply searched this page for the time, ie 30s, assuming that it was still the default).

Additionally, it was restricting the size of the attachment, which is determined (at least in this case, I don’t know enough about nginx to say this is the only thing that controls it), by client_max_body_size.

Solution:
The meat of the solution was to add

client_max_body_size 0;
lingering_time 3600s;

to the appropriate nginx.conf file.  However, this not a great thing to do site wide, so if you use this solution, be sure to wrap it in as specific of a “location” as you can, eg.
location /page_where_video_is_uploaded/ {
client_max_body_size 0;
lingering_time 3600s;

###Everything else required to make your pages load, depending on your configuration###
}