Rails server issue in production environment

Hi guys,

I'm having troubles to run rails server in production environment.

It's working fine in development environment.

However if i run it as 'rails server -e production',
Static page like public/index.html is fine.
But any controller (maybe it's DB) involved requests will fail and cause
the server died, can't stop it by CTRL+C, have to kill the process. The
page loading never end. No error page returned.

I'm assuming it could be some db connection issue.
Because production db is using AWS RDS.
However, both 'rails c production' and 'rails dbconsole production' can
successfully connect to RDS.

I couldn't figured out why.

Could you (i.e., the OP) please also share some details about the environment,
like O/S, softwares in use, etc.?

      --- Eric

···

On Friday 18 July 2014, 16:50:08, Harisankar P S wrote:

Can you share your production log? Since it dies after the request is made
the answer should definitely be in that log file.

Can you share your production log? Since it dies after the request is made
the answer should definitely be in that log file.

···

On Fri, Jul 18, 2014 at 4:45 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

Hi guys,

I'm having troubles to run rails server in production environment.

It's working fine in development environment.

However if i run it as 'rails server -e production',
Static page like public/index.html is fine.
But any controller (maybe it's DB) involved requests will fail and cause
the server died, can't stop it by CTRL+C, have to kill the process. The
page loading never end. No error page returned.

I'm assuming it could be some db connection issue.
Because production db is using AWS RDS.
However, both 'rails c production' and 'rails dbconsole production' can
successfully connect to RDS.

I couldn't figured out why.

--
Harisankar P S
https://twitter.com/coderhs | http://tech.hsps.in

Unfortunately no errors in server log.

=> Booting Thin
=> Rails 4.0.2 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
I, [2014-07-18T07:23:38.894423 #10672] INFO -- : Started GET "/" for
121.24.167.143 at 2014-07-18 07:23:38 -0400
I, [2014-07-18T07:23:39.012780 #10672] INFO -- : Processing by
HomeController#index as HTML
I, [2014-07-18T07:23:39.277530 #10672] INFO -- : Rendered
shared/_cms.html.slim (94.6ms)
I, [2014-07-18T07:23:39.279371 #10672] INFO -- : Rendered
shared/_cms.html.slim (1.6ms)
I, [2014-07-18T07:23:39.288551 #10672] INFO -- : Rendered
shared/_cms.html.slim (9.0ms)
I, [2014-07-18T07:23:39.289601 #10672] INFO -- : Rendered
shared/_cms.html.slim (0.9ms)
I, [2014-07-18T07:23:39.290637 #10672] INFO -- : Rendered
shared/_cms.html.slim (0.9ms)
I, [2014-07-18T07:23:39.294696 #10672] INFO -- : Rendered
home/partials/_video_modal.html.slim (3.4ms)
I, [2014-07-18T07:23:39.296234 #10672] INFO -- : Rendered
shared/_cms.html.slim (1.3ms)
I, [2014-07-18T07:23:39.307137 #10672] INFO -- : Rendered
shared/_cms.html.slim (0.9ms)
I, [2014-07-18T07:23:39.308554 #10672] INFO -- : Rendered
shared/_cms.html.slim (0.9ms)
I, [2014-07-18T07:23:39.326743 #10672] INFO -- : Rendered
shared/_cms.html.slim (1.5ms)
I, [2014-07-18T07:23:39.331372 #10672] INFO -- : Rendered
sidebar/_free_ebook.html.slim (22.1ms)
I, [2014-07-18T07:23:39.343282 #10672] INFO -- : Rendered
shared/_cms.html.slim (1.3ms)
I, [2014-07-18T07:23:39.343573 #10672] INFO -- : Rendered
sidebar/_property_calculator.html.slim (11.6ms)
I, [2014-07-18T07:23:39.347515 #10672] INFO -- : Rendered
shared/_cms.html.slim (1.2ms)
I, [2014-07-18T07:23:39.348342 #10672] INFO -- : Rendered
shared/_newsletter.html.slim (4.2ms)
I, [2014-07-18T07:23:39.361531 #10672] INFO -- : Rendered
shared/_reviewers.html.slim (12.6ms)
I, [2014-07-18T07:23:39.361693 #10672] INFO -- : Rendered
home/index.html.slim within layouts/application (305.2ms)
Killed

···

On Fri, Jul 18, 2014 at 9:20 PM, Harisankar P S <mailme@hsps.in> wrote:

Can you share your production log? Since it dies after the request is made
the answer should definitely be in that log file.

On Fri, Jul 18, 2014 at 4:45 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

Hi guys,

I'm having troubles to run rails server in production environment.

It's working fine in development environment.

However if i run it as 'rails server -e production',
Static page like public/index.html is fine.
But any controller (maybe it's DB) involved requests will fail and cause
the server died, can't stop it by CTRL+C, have to kill the process. The
page loading never end. No error page returned.

I'm assuming it could be some db connection issue.
Because production db is using AWS RDS.
However, both 'rails c production' and 'rails dbconsole production' can
successfully connect to RDS.

I couldn't figured out why.

--
Harisankar P S
https://twitter.com/coderhs | http://tech.hsps.in

AWS Redhat 6.5
RDS mysql
ruby 2.0.0
rails 4.0.2

···

On Fri, Jul 18, 2014 at 9:25 PM, Eric MSP Veith <eveith@wwweb-library.net> wrote:

On Friday 18 July 2014, 16:50:08, Harisankar P S wrote:
> Can you share your production log? Since it dies after the request is
made
> the answer should definitely be in that log file.

Could you (i.e., the OP) please also share some details about the
environment,
like O/S, softwares in use, etc.?

                        --- Eric

It's been solved.
However I don't know why.

The problem is assets.
'rake assets:precompile' fixed it.

Thanks guys

···

On Fri, Jul 18, 2014 at 9:31 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

AWS Redhat 6.5
RDS mysql
ruby 2.0.0
rails 4.0.2

On Fri, Jul 18, 2014 at 9:25 PM, Eric MSP Veith <eveith@wwweb-library.net> > wrote:

On Friday 18 July 2014, 16:50:08, Harisankar P S wrote:
> Can you share your production log? Since it dies after the request is
made
> the answer should definitely be in that log file.

Could you (i.e., the OP) please also share some details about the
environment,
like O/S, softwares in use, etc.?

                        --- Eric

It's been solved.
However I don't know why.

The problem is assets.
'rake assets:precompile' fixed it.

In production ENV the assets (e.g. static assets) are served by the web server not by rack-servers. So you have to run ‘rake assets:precompile’ and configure the web-server to actually serve them.

···

On Jul 18, 2014, at 5:02 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

Thanks guys

On Fri, Jul 18, 2014 at 9:31 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:
AWS Redhat 6.5
RDS mysql
ruby 2.0.0
rails 4.0.2

On Fri, Jul 18, 2014 at 9:25 PM, Eric MSP Veith <eveith@wwweb-library.net> wrote:
On Friday 18 July 2014, 16:50:08, Harisankar P S wrote:
> Can you share your production log? Since it dies after the request is made
> the answer should definitely be in that log file.

Could you (i.e., the OP) please also share some details about the environment,
like O/S, softwares in use, etc.?

                        --- Eric

It is a bit strange that the log didn't say anything about the assets
precompile not being done. Usually in the log it would mention that you are
requred to run assets:precompile. Anyway happy to know that the issue has
been resolved.

regards,

Harisankar P S

···

On Sat, Jul 19, 2014 at 6:50 PM, Panagiotis Atmatzidis <atma@convalesco.org> wrote:

On Jul 18, 2014, at 5:02 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

It's been solved.
However I don't know why.

The problem is assets.
'rake assets:precompile' fixed it.

In production ENV the assets (e.g. static assets) are served by the web
server not by rack-servers. So you have to run ‘rake assets:precompile’ and
configure the web-server to actually serve them.

Thanks guys

On Fri, Jul 18, 2014 at 9:31 PM, Jiajia Wang <jjwang0506@gmail.com> wrote:

AWS Redhat 6.5
RDS mysql
ruby 2.0.0
rails 4.0.2

On Fri, Jul 18, 2014 at 9:25 PM, Eric MSP Veith <eveith@wwweb-library.net >> > wrote:

On Friday 18 July 2014, 16:50:08, Harisankar P S wrote:
> Can you share your production log? Since it dies after the request is
made
> the answer should definitely be in that log file.

Could you (i.e., the OP) please also share some details about the
environment,
like O/S, softwares in use, etc.?

                        --- Eric

--
Harisankar P S
https://twitter.com/coderhs | http://tech.hsps.in