Anthony Anthony - 1 year ago 235
Ruby Question

Unicorn & Pry in Rails

I'm unable to use pry with Unicorn as I get booted out of my prompt after sometime. Here is a quick overview:

In a custom action in a controller I have this:

def assign

Getting to this route is no problem and I even get the familar
prompt like so:

8: def assign
=> 10: binding.pry
11: end

[1] pry(#<RolesController>)>

After a period of about a minute I get this which kicks me out of the pry prompt:

[3] pry(#<RolesController>)> E, [2014-08-21T16:29:01.698472 #4780] ERROR -- : worker=0 PID:4852 timeout (61s > 60s), killing
E, [2014-08-21T16:29:01.721420 #4780] ERROR -- : reaped #<Process::Status: pid 4852 SIGKILL (signal 9)> worker=0
I, [2014-08-21T16:29:01.745491 #5109] INFO -- : worker=0 ready

Is there a way to not kill a process while in pry?

Answer Source

I was able to fix this by changing my timeout configuration in my config/unicorn.rb file like so:

if ENV["RAILS_ENV"] == "development"
  worker_processes 1
  timeout 10000
  worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
  timeout 15
  preload_app true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download