pry-remote icon indicating copy to clipboard operation
pry-remote copied to clipboard

DRb::DRbConnError

Open julienXX opened this issue 13 years ago • 20 comments

Hi, I'm trying to use pry-remote but I get:

$ be pry-remote
/Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:736:in rescue in block in open': druby://localhost:9876 - #<Errno::ECONNREFUSED: Connection refused - connect(2)> (DRb::DRbConnError) from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:730:inblock in open' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:729:in each' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:729:inopen' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1191:in initialize' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1171:innew' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1171:in open' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1087:inblock in method_missing' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1105:in with_friend' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1086:inmethod_missing' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/pry-remote-0.1.0/lib/pry-remote.rb:110:in run' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/pry-remote-0.1.0/bin/pry-remote:4:in<top (required)>' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin/pry-remote:19:in load' from /Users/julien/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin/pry-remote:19:in

'

My environment is:

  • rbenv 0.2.1
  • ruby 1.9.3-p0 but I get the same error with 1.9.2-p290
  • pow 0.3.2

Any idea what's going wrong?

Thanks, Julien

julienXX avatar Nov 24 '11 17:11 julienXX

Looks like the server isn't running, or not with the right host and port.

Mon-Ouie avatar Nov 24 '11 21:11 Mon-Ouie

@julienXX Did you figure it out?

@Mon-Ouie Do you know how to set it up correctly? I use Passenger 3.0.11.

karellm avatar Jun 08 '12 20:06 karellm

@karellm it's now working but in the meantime I had a new machine set up. Don't know what changed, sorry.

julienXX avatar Jun 09 '12 11:06 julienXX

simple fix: Run the program calling the binding.remote_pry before you run pry-remote, otherwise the pry server is not running

alexisperrier avatar Jul 19 '12 14:07 alexisperrier

This problem also occurs when the server "goes away". Whilst running pry-remote on a rails->unicorn->nginx stack, if incorrectly configured, nginx or unicorn will close the connection meaning that requests result in the error above. I configured unicorn and nginx like this: (it's not airtight, but can get you through a few debugs)

  1. Update your Gemfile (development and test groups only):

gem "pry-remote", :require => "pry-remote"

  1. Update the timeouts in Nginx: (your paths may vary and I'm not sure that this step is absolutely necessary (your local/friendly beard may assist)

a) [sudo] vi /usr/local/etc/nginx/nginx.conf b) c) change keepalive_timeout to 3600 (1hr; loadsa-debug-time!) d) save and quit

  1. Update your local Unicorn config for the app in question

a) vi config/unicorn.rb b) change timeout to 3600 c) save and quit

  1. Update the proxy timeout settings for the app

a) vi ../your/path/here/shared/nginx/config_file (this is sometimes in your nginx.conf) b) change proxy_send_timeout to 3600 c) change proxy_read_timeout to 3600

  1. Restart everything. (sudo nginx -s reload)

  2. Get yourself into the target method. Add binding.remote_pry (no quotes)

  3. Access the resource through the browser (get yourself into the state of requesting this method by hook or crook)

  4. Now, in your favourite terminal app;

    pry-remote

If you've done it right, you should get a prompt and you can do all your usual terminal hackery. Occasionally the app goes a little bananas and you can't connect to the DRb server, so just restart the app and retry.

Hope that helps! :-)

Gav

gavinlaking avatar Dec 10 '12 07:12 gavinlaking

Anyone had issues getting this to work with POW?

esparkman avatar Mar 06 '13 21:03 esparkman

Hey,

Does your issue or the previous one still happen with the latest gem release? Some similar issues (not sure if they're actually the same) have been fixed.

Mon-Ouie avatar Mar 07 '13 21:03 Mon-Ouie

I'm having this issue currently, on a rails/unicorn/nginx stack like @gavinlaking talked about. I'm trying out his fixes now.

Also, is pry-remote meant to be used in staging environments? I'm trying to get it setup so that I can run pry on my branch's code against production data. Didn't know if that was a major security risk or something.

Stacktrace, running against master of pry-remote:

bundle exec pry-remote
/usr/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open': druby://127.0.0.1:9876 - #<Errno::ECONNREFUSED: Connection refused - connect(2)> (DRb::DRbConnError)
    from /usr/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:729:in `each'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:729:in `open'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1171:in `new'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1171:in `open'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
    from /usr/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
    from /var/www/heyzap.com/shared/bundle/ruby/1.9.1/bundler/gems/pry-remote-98be78964d0b/lib/pry-remote.rb:285:in `run'
    from /var/www/heyzap.com/shared/bundle/ruby/1.9.1/bundler/gems/pry-remote-98be78964d0b/bin/pry-remote:4:in `<top (required)>'
    from /var/www/heyzap.com/shared/bundle/ruby/1.9.1/bin/pry-remote:23:in `load'
    from /var/www/heyzap.com/shared/bundle/ruby/1.9.1/bin/pry-remote:23:in `<main>'

MaxGabriel avatar Dec 06 '13 18:12 MaxGabriel

I would love an answer to this as I am getting the same error but I am running rvm, ruby 1.9.3p484, Pow

AHaymond avatar Jan 15 '14 15:01 AHaymond

@MaxGabriel pry-remote is quite unsafe to use on a computer that untrusted users can connect to : if a connection to the right host/port combination is allowed, it doesn't do any sort of checking (and then they can run arbitrary ruby code on that machine).

Mon-Ouie avatar Jan 18 '14 17:01 Mon-Ouie

Thanks Mon-Ouie. I ended up getting a solution working with just regular Pry.

MaxGabriel avatar Jan 18 '14 17:01 MaxGabriel

Same error. Having trouble getting this to work with pow + 1.9.3 as well. Any suggestions?

iloveitaly avatar Jun 20 '14 11:06 iloveitaly

@iloveitaly i am having the same issue as well with Ruby 2.0.0-p353

benniemosher avatar Jul 01 '14 16:07 benniemosher

same here with Ruby 2.1.3.

emaiax avatar Oct 23 '14 14:10 emaiax

Solution might be creating a file ".prv" with following content:

Pry.config.correct_indent = false
Pry.config.auto_indent = false

It's working for my ruby-1.9.3-p484 and pow 0.5.0

reelman avatar Dec 05 '14 00:12 reelman

This might not help the masses but I am sure other n00bs (like me) will come to this page looking for this answer. I am running passenger on apache and I was getting the error pasted at the top of this thread. It's not enough to install the gem, you also have to include "require 'pry-remote'" in your main .rb file. Once I include that, add binding.remote-pry where you need it, run your call (which should pause) then enter pry-remote in the cli and voila!

jducrot avatar May 12 '15 20:05 jducrot

Since I'm experiencing the same Issue and it's driving me mad because I can't debug I've also opened a StackOverflow topic for help!

Can we please combine forces and solve this problem?

All the information and logs that I have are mentioned in the following post:

http://stackoverflow.com/questions/32780971/pry-remote-not-triggered-rails-4

DelawareConsulting avatar Sep 28 '15 07:09 DelawareConsulting

I had the same issues using Rails + Passenger + Apache. It turned out it was a conflict with pry-byebug (8.2.4). After I removed pry-byebug it worked fine.

jfedgar avatar May 04 '18 12:05 jfedgar

I don't have pry-byebug installed and non of the solutions worked for me above!

modullar avatar Feb 09 '21 19:02 modullar

hit the API, if you feel api is stuck then from console type

remote-pry

jaswinderahuja avatar Mar 15 '24 19:03 jaswinderahuja