Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicorn workers timeout

I'm developing an AngularJS (front-end) running in an Nginx web server that sends request to a Rails API (backend) running in a Unicorn application server.

I recognize I'm just a developer and I have no idea about servers administration, so I just put the servers and start them.

The application is working, however, Unicorn has a strange behaviour. When I start it I always get this error:

roberto@ubuntu:~/dev/scripts$ ./start_unicorn.sh 
I, [2014-06-14T11:46:06.085834 #4258]  INFO -- : Refreshing Gem list
I, [2014-06-14T11:46:11.591592 #4258]  INFO -- : listening on addr=0.0.0.0:8080 fd=10
I, [2014-06-14T11:46:12.087321 #4258]  INFO -- : master process ready
I, [2014-06-14T11:46:12.151320 #4263]  INFO -- : worker=0 ready
I, [2014-06-14T11:46:12.150526 #4266]  INFO -- : worker=1 ready
E, [2014-06-14T11:46:39.112668 #4258] ERROR -- : worker=0 PID:4263 timeout (16s > 15s), killing
E, [2014-06-14T11:46:39.112898 #4258] ERROR -- : worker=1 PID:4266 timeout (16s > 15s), killing
E, [2014-06-14T11:46:39.118081 #4258] ERROR -- : reaped #<Process::Status: pid 4263 SIGKILL (signal 9)> worker=0
E, [2014-06-14T11:46:39.118634 #4258] ERROR -- : worker=1 PID:4266 timeout (16s > 15s), killing
E, [2014-06-14T11:46:39.121820 #4258] ERROR -- : reaped #<Process::Status: pid 4266 SIGKILL (signal 9)> worker=1
I, [2014-06-14T11:46:39.172067 #4284]  INFO -- : worker=1 ready
I, [2014-06-14T11:46:39.172620 #4281]  INFO -- : worker=0 ready

It takes some seconds until it responds. And this happens continuosly.

I guess I'm missing some configuration but no idea...

If you need any more details, such as config files, just let me know

like image 432
Rober Avatar asked Jun 14 '14 09:06

Rober


1 Answers

Do you have your assets precompiled ? are you in production ? If not when you start your server and get your first request, rails will try to compile your assets which can take more than 15 seconds and reach the unicorn timeout.

In your start.sh you should have somewhere

export RAILS_ENVIRONEMENT=production

And during you deployment you should have :

rake assets:precompile

like image 164
Luc Boissaye Avatar answered Oct 13 '22 22:10

Luc Boissaye