My Unicorn server is getting shutdown on EC-2

175 Views Asked by At
Unicorn error log: 

INFO -- : Refreshing Gem list
I, [2014-10-26T07:46:40.418950 #25903]  INFO -- : unlinking existing socket=/home/ubuntu/rails/shared/tmp/.sock
I, [2014-10-26T07:46:40.452871 #25903]  INFO -- : listening on addr=/home/ubuntu/rails/shared/tmp/.sock fd=10
I, [2014-10-26T07:46:40.453466 #25903]  INFO -- : listening on addr=0.0.0.0:8080 fd=11
I, [2014-10-26T07:46:43.816336 #25903]  INFO -- : master process ready
I, [2014-10-26T07:46:49.218342 #25907]  INFO -- : worker=0 ready
I, [2014-10-26T07:46:50.778582 #25910]  INFO -- : worker=1 ready
I, [2014-10-26T07:46:51.022575 #25913]  INFO -- : worker=2 ready
I, [2014-10-26T07:46:51.137159 #25916]  INFO -- : worker=3 ready
E, [2014-11-14T06:53:26.084384 #25903] ERROR -- : reaped #<Process::Status: pid 25907 SIGKILL (signal 9)> worker=0
E, [2014-11-14T06:53:26.347536 #25903] ERROR -- : Cannot allocate memory - fork(2) (Errno::ENOMEM)
1

There are 1 best solutions below

0
On

It is clearly a memory issue. You can easily detect it by reading the error message:

Cannot allocate memory - fork(2) (Errno::ENOMEM)

Now you have two options:

  1. Get an instance with more memory on EC2 -try t2.small I assume it would be enough.
  2. Reduce the number of Unicorn workers as each of them consumes memory by its own.