pry-remote
pry-remote copied to clipboard
DRb::DRbConnError
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:in
block 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:in
open'
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:in
new'
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:in
block 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:in
method_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
Looks like the server isn't running, or not with the right host and port.
@julienXX Did you figure it out?
@Mon-Ouie Do you know how to set it up correctly? I use Passenger 3.0.11.
@karellm it's now working but in the meantime I had a new machine set up. Don't know what changed, sorry.
simple fix: Run the program calling the binding.remote_pry before you run pry-remote, otherwise the pry server is not running
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)
- Update your Gemfile (development and test groups only):
gem "pry-remote", :require => "pry-remote"
- 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)
- Update your local Unicorn config for the app in question
a) vi config/unicorn.rb b) change timeout to 3600 c) save and quit
- 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
-
Restart everything. (sudo nginx -s reload)
-
Get yourself into the target method. Add
binding.remote_pry
(no quotes) -
Access the resource through the browser (get yourself into the state of requesting this method by hook or crook)
-
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
Anyone had issues getting this to work with POW?
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.
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>'
I would love an answer to this as I am getting the same error but I am running rvm, ruby 1.9.3p484, Pow
@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).
Thanks Mon-Ouie. I ended up getting a solution working with just regular Pry.
Same error. Having trouble getting this to work with pow + 1.9.3 as well. Any suggestions?
@iloveitaly i am having the same issue as well with Ruby 2.0.0-p353
same here with Ruby 2.1.3.
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
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!
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
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.
I don't have pry-byebug
installed and non of the solutions worked for me above!
hit the API, if you feel api is stuck then from console type
remote-pry