Search code examples
ruby-on-railsrubyunicornpry

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
    binding.pry
  end

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

     8: def assign
     9:
 => 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?


Solution

  • 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
    else
      worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
      timeout 15
      preload_app true
    end