Heroku, Passenger and H12/H13 Timeouts

385 views
Skip to first unread message

Cheyne Wallace

unread,
Sep 19, 2013, 12:42:38 AM9/19/13
to
Hey guys, 

I'v just noticed you guys have done some work on making it easier to deploy passenger with nginx on Heroku, im trialing it out now on my staging environment and im liking what im seeing so far as a possible Unicorn replacement. 

I notice one of the features listed on the passenger-heroku-demo github page is request/response buffering and mentions it can help with slow clients ... I have a problem with slow clients.

So my question, is there any way using Passenger/nginx on Heroku can help with the 30 second Heroku H12/H13 timeouts?.  
That is Heroku's hard limit that cuts of any connection after 30 seconds?   

I offer file uploads on my app, and 70% of my users can upload a 2MB file in a few seconds, but the other 30% timeout and their connection lost. 

Heroku offers no solution for this, instead saying I need to upload to S3 or something similar first, then pull it back down, then process the file with some background process, then push it back to S3 all whilst managing a normal text form post in the process, which is just a pain in the ass .. If I could extend my timeouts to 60 seconds, it would solve all my problems, but of course, you cant. 

Heroku mentions that if you're able to send even a single packet back to the client during that 30 seconds, it will restart the timer.  I can't seem to find a way to do that whilst uploading a file ..

Is there anything that can be done with Passenger/nginx to help with this?  

That would pretty much be a silver bullet for me to switch ..

Tinco Andringa

unread,
Sep 19, 2013, 5:18:46 AM9/19/13
to phusion-...@googlegroups.com
Hi Cheyne,

Unfortunately, from the documentation it looks as though this request
timeout is enforced by the Heroku routing layer. Phusion Passenger
can't do anything to influence that. I find it surprising though,
because for example websockets also need long running HTTP requests,
if it is true that Heroku drops all HTTP connections after 30 seconds
then they are holding some technologies back.

H13 can be prevented by configuring Passenger/Nginx correctly.

I would recommend you upload a Rails app to Heroku that sleeps 40
seconds in a controller. If you get an H13 we can do something about
it, if you get a H12 you'll have to contact Heroku to find out if they
can help you.

Kind regards,
Tinco

On Thu, Sep 19, 2013 at 6:40 AM, Cheyne Wallace
<cheyne....@gmail.com> wrote:
> Hey guys,
>
> I'v just noticed you guys have done some work on making it easier to deploy
> passenger with nginx on Heroku, im trailing it out now on my staging
> environment and im liking what im seeing so far as a possible Unicorn
> replacement.
>
> I notice one of the features listed on the passenger-heroku-demo github page
> is request/response buffering and mentions it can help with slow clients ...
> I have a problem with slow clients.
>
> So my question, is there any way using Passenger/nginx on Heroku can help
> with the 30 second Heroku H12/H13 timeouts?.
> That is Heroku's hard limit that cuts of any connection after 30 seconds?
> https://devcenter.heroku.com/articles/error-codes#h12-request-timeout
>
> I offer file uploads on my app, and 70% of my users can upload a 2MB file in
> a few seconds, but the other 30% timeout and their connection lost.
>
> Heroku offers no solution for this, instead saying I need to upload to S3 or
> something similar first, then pull it back down, then process the file with
> some background process, then push it back to S3, which is just a pain in
> the ass .. If I could extend my timeouts to 60 seconds, it would solve all
> my problems, but of course, you cant.
>
> Heroku mentions that if you're able to send even a single packet back to the
> client during that 30 seconds, it will restart the timer. I can't seem to
> find a way to do that whilst uploading a file ..
>
> Is there anything that can be done with Passenger/nginx to help with this?
>
> That would pretty much be a silver bullet for me to switch ..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Cheyne Wallace

unread,
Sep 19, 2013, 2:09:55 PM9/19/13
to phusion-...@googlegroups.com
Thanks Tinco 

Yes it is enforced by the routing layer, I was just wondering if nginx/passenger could be configured in some sort of keep alive session state that maybe sends a packet back to the client every few seconds on long connections, which would prevent to timeout, but it doesnt sound like it.

I'll keep searching, thanks for the reply.

Cheers
Cheyne

Tinco Andringa

unread,
Sep 19, 2013, 2:18:43 PM9/19/13
to phusion-...@googlegroups.com
If you don't mind using modern technologies (i.e. dropping older
browsers), you could use websockets to achieve file transfer in this
way.

Good luck!

Cheyne Wallace

unread,
Sep 19, 2013, 7:29:23 PM9/19/13
to phusion-...@googlegroups.com
I would look into WebSockets, but Heroku does not support them.

Maybe I just need to move off Heroku, I seem to be fighting with it more often lately.
Reply all
Reply to author
Forward
0 new messages