Sebastião Giacheto F. Júnior
2012-Sep-18 03:23 UTC
Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"
Hi, I have a Rails 3.2 app. There is a specific request that takes a long time to execute. The context is, the user uploads a pdf, and then we have some processing through carrierwave + rmagick that generate a jpeg from the first page of the document. Everything works in dev mode using both webrick and thin. The problem happens on the prod environment with Nginx + Passenger. The request takes a lot of time and the browser is redirected to a "504 Gateway time-out". At this point, the file was already sent, but it''s being processed (the pdf manipulation task really takes time). I found several threads with solutions like this: https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/LOEb7x-nAy0 that basically consists in patching the hardcoded timeout values on the passenger source before compiling the module. There is actually no error on the request and the manipulation of the files itself. After a while, the work on the server is finished without any bad behaviour. The processed jpeg is served by the app as nothing bad has actually hapened. This evidence summed up with the fact that everything works in dev mode, points to a nginx+passenger problem. Anyone has a more clearer solution to the passenger+nginx configuration scheme? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Benjamin Iandavid Rodriguez
2012-Sep-18 04:21 UTC
Re: Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"
For actions that take a lot of time I suggest to send it to the background if possible, you can use: - resque https://github.com/defunkt/resque - sideqik http://mperham.github.com/sidekiq/ Regards 2012/9/17 Sebastião Giacheto F. Júnior <sebastorama-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> Hi, > > I have a Rails 3.2 app. There is a specific request that takes a long > time to execute. The context is, the user uploads a pdf, and then we > have some processing through carrierwave + rmagick that generate a > jpeg from the first page of the document. Everything works in dev mode > using both webrick and thin. The problem happens on the prod > environment with Nginx + Passenger. > > The request takes a lot of time and the browser is redirected to a > "504 Gateway time-out". At this point, the file was already sent, but > it''s being processed (the pdf manipulation task really takes time). I > found several threads with solutions like this: > > https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/LOEb7x-nAy0 > that basically consists in patching the hardcoded timeout values on > the passenger source before compiling the module. > > There is actually no error on the request and the manipulation of the > files itself. After a while, the work on the server is finished > without any bad behaviour. The processed jpeg is served by the app as > nothing bad has actually hapened. This evidence summed up with the > fact that everything works in dev mode, points to a nginx+passenger > problem. > > Anyone has a more clearer solution to the passenger+nginx > configuration scheme? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Sebastião Giacheto F. Júnior
2012-Sep-18 04:58 UTC
Re: Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"
Thanks for your reply, but there''s actually no need for speed increase or scalability whatsoever so there''s no need to setup a background job queue system. If I cannot solve this problem, I''ll probably try thin instead of passenger. I''m actually curious about the solution of this issue :D On Sep 18, 1:22 am, Benjamin Iandavid Rodriguez <ian....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> For actions that take a lot of time I suggest to send it to the background > if possible, you can use: > - resquehttps://github.com/defunkt/resque > - sideqikhttp://mperham.github.com/sidekiq/ > > Regards > > 2012/9/17 Sebastião Giacheto F. Júnior <sebastor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > > > Hi, > > > I have a Rails 3.2 app. There is a specific request that takes a long > > time to execute. The context is, the user uploads a pdf, and then we > > have some processing through carrierwave + rmagick that generate a > > jpeg from the first page of the document. Everything works in dev mode > > using both webrick and thin. The problem happens on the prod > > environment with Nginx + Passenger. > > > The request takes a lot of time and the browser is redirected to a > > "504 Gateway time-out". At this point, the file was already sent, but > > it''s being processed (the pdf manipulation task really takes time). I > > found several threads with solutions like this: > > >https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger... > > that basically consists in patching the hardcoded timeout values on > > the passenger source before compiling the module. > > > There is actually no error on the request and the manipulation of the > > files itself. After a while, the work on the server is finished > > without any bad behaviour. The processed jpeg is served by the app as > > nothing bad has actually hapened. This evidence summed up with the > > fact that everything works in dev mode, points to a nginx+passenger > > problem. > > > Anyone has a more clearer solution to the passenger+nginx > > configuration scheme? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visithttps://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Benjamin Iandavid Rodriguez
2012-Sep-18 05:23 UTC
Re: Re: Nginx + Phusion Passenger 3 problem with "504 Gateway time-out"
Many times I find best to use Nginx + unicorn as the app server, you might give that a try. 2012/9/17 Sebastião Giacheto F. Júnior <sebastorama-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> Thanks for your reply, but there''s actually no need for speed increase > or scalability whatsoever so there''s no need to setup a background job > queue system. If I cannot solve this problem, I''ll probably try thin > instead of passenger. I''m actually curious about the solution of this > issue :D > > On Sep 18, 1:22 am, Benjamin Iandavid Rodriguez <ian....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > For actions that take a lot of time I suggest to send it to the > background > > if possible, you can use: > > - resquehttps://github.com/defunkt/resque > > - sideqikhttp://mperham.github.com/sidekiq/ > > > > Regards > > > > 2012/9/17 Sebastião Giacheto F. Júnior <sebastor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > > > > > > > > > > > Hi, > > > > > I have a Rails 3.2 app. There is a specific request that takes a long > > > time to execute. The context is, the user uploads a pdf, and then we > > > have some processing through carrierwave + rmagick that generate a > > > jpeg from the first page of the document. Everything works in dev mode > > > using both webrick and thin. The problem happens on the prod > > > environment with Nginx + Passenger. > > > > > The request takes a lot of time and the browser is redirected to a > > > "504 Gateway time-out". At this point, the file was already sent, but > > > it''s being processed (the pdf manipulation task really takes time). I > > > found several threads with solutions like this: > > > > >https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger. > .. > > > that basically consists in patching the hardcoded timeout values on > > > the passenger source before compiling the module. > > > > > There is actually no error on the request and the manipulation of the > > > files itself. After a while, the work on the server is finished > > > without any bad behaviour. The processed jpeg is served by the app as > > > nothing bad has actually hapened. This evidence summed up with the > > > fact that everything works in dev mode, points to a nginx+passenger > > > problem. > > > > > Anyone has a more clearer solution to the passenger+nginx > > > configuration scheme? > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visithttps://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Apparently Analagous Threads
- Announcing release for Phusion Passenger 4.0 on CentOS Linux 7 x86_64 SCL
- Announcing release for Phusion Passenger 4.0 on CentOS Linux 6 x86_64 SCL
- Puppet 3x Debian Wheezy and Phusion Passenger
- AJAX truncated response on Phusion Passenger v3.0.17 on CentOS v6.x
- redis, pub/sub, rails 3, phusion passenger