Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set unicorn timeout

I use rails 3.0.11, ruby 1.9.3-p0, nginx 1.0.4 and unicorn 3.6.2 for my project. And I have got a problem. I have to do long-term operation on my server. It's about 150 seconds. And it's okay in this case.

I've set up my nginx config in location

proxy_read_timeout 240;
proxy_send_timeout 240;

And set up my unicorn.rb file with command

timeout 240

But I always get 502 bad gateway error. I think, problem with unicorn. I get this unicorn logs

E, [2012-05-21T11:52:21.052382 #30423] ERROR -- : worker=1 PID:30871 timeout (104.052329915s > 60s), killing
E, [2012-05-21T11:52:21.080378 #30423] ERROR -- : reaped #<Process::Status: pid 30871 SIGKILL (signal 9)> worker=1
I, [2012-05-21T11:52:21.105045 #30423]  INFO -- : worker=1 spawning...
I, [2012-05-21T11:52:21.111148 #894]  INFO -- : worker=1 spawned pid=894   
I, [2012-05-21T11:52:21.111659 #894]  INFO -- : Refreshing Gem list

Can you help me? Any help is appreciated. Thank you.

like image 348
caulfield Avatar asked May 21 '12 12:05

caulfield


1 Answers

Copying the answer from the comments in order to remove this question from the "Unanswered" filter:

I have never used this gem, but if you're doing this after 'deploy:restart', 'unicorn:reload' you need to restart unicorn, not only reload it. sudo /etc/init.d/unicorn restart and the timeout will be set. Reload and restart are two different things in unicorn.

~ answer per Maurício Linhares

like image 58
DreadPirateShawn Avatar answered Oct 13 '22 12:10

DreadPirateShawn