Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRb::DRbConnError #8

Open
julienXX opened this issue Nov 24, 2011 · 20 comments
Open

DRb::DRbConnError #8

julienXX opened this issue Nov 24, 2011 · 20 comments

Comments

@julienXX
Copy link

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

@Mon-Ouie
Copy link
Owner

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

@karellm
Copy link

karellm commented Jun 8, 2012

@julienXX Did you figure it out?

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

@julienXX
Copy link
Author

julienXX commented Jun 9, 2012

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

@alexisperrier
Copy link

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

@gavinlaking
Copy link

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

@esparkman
Copy link

Anyone had issues getting this to work with POW?

@Mon-Ouie
Copy link
Owner

Mon-Ouie commented Mar 7, 2013

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.

@MaxGabriel
Copy link

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>'

@AHaymond
Copy link

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

@Mon-Ouie
Copy link
Owner

@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).

@MaxGabriel
Copy link

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

@iloveitaly
Copy link

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

@benniemosher
Copy link

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

@emaiax
Copy link

emaiax commented Oct 23, 2014

same here with Ruby 2.1.3.

@reelman
Copy link

reelman commented Dec 5, 2014

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

@jducrot
Copy link

jducrot commented May 12, 2015

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!

@DelawareConsulting
Copy link

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

@jfedgar
Copy link

jfedgar commented May 4, 2018

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.

shimbaco added a commit to annict/annict that referenced this issue May 26, 2019
@modullar
Copy link

modullar commented Feb 9, 2021

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

@jaswinderahuja
Copy link

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

remote-pry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests