Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 782
Anthony Avatar asked Aug 21 '14 20:08

Anthony


People also ask

What does being a unicorn mean?

I was hoping to be their unicorn. “Unicorn” describes a person who joins a couple as their third partner, for sex or even for something more committed.

What does it mean when a girl is a unicorn?

What Is A Unicorn? A unicorn is a person who is willing to join an existing couple. They may join the couple only for sex, or they may become a more involved part of the relationship and spend nonsexual, companionship time together too.

What does it mean when a guy calls you a unicorn?

A unicorn is a mythical creature, which means it is something that is considered a fantasy or something that doesn't exist. In terms of a man, this could mean that an individual is rare and not easy to find.

What's a unicorn in dating?

What is a unicorn? Unicorn is a term used to describe a human who is interested in meeting a couple. This person might be looking for one great night, something more serious and longterm, or anything in between.


2 Answers

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
like image 56
Anthony Avatar answered Sep 26 '22 19:09

Anthony


I think for proper debugging in development you have to configure unicorn not to timeout in dev mode. The unicorn worker is waiting for the response of your controller action you pry'd into and hence it does not get an response within the set timeout window the process is killed.

like image 22
jethroo Avatar answered Sep 25 '22 19:09

jethroo