1

I have a twist on the much-asked "how to get rubymine debugging to work" on a rails project. Selecting "Run/Debug 'myproject'" in RubyMine pops up a dialog titled "connecting to the debugger" which supposedly fails 10 seconds later (timeout). However, In the debug console, there is an informational message which changes from "(i) Disconnected" to "(i) Connected" as soon as I invoke Run/Debug. After the timeout, this changes back to "(i) Disconnected" Is the connection actually happening but RubyMine doesn't know?

Edit: I should note that I am able to connect to a debug server (rdebug-ide) started manually outside of RubyMine, and my computer system (Mac OS X) has a name, and that no errors are displayed in the console....RubyMine just doesn't connect when it starts the debug server itself automatically.

Bogatyr
  • 19,255
  • 7
  • 59
  • 72
  • What ruby and [debug gem versions](http://stackoverflow.com/a/10325110/104891) do you use? What's your OS? On Mac it may help if you configure your machine name. – CrazyCoder Apr 24 '13 at 10:01
  • Please see my edit. It is not a gem problem because I can connect from RM to an externally started rdebug-ide running the rails server and debugging works fine that way. And my computer has a name. – Bogatyr Apr 24 '13 at 12:21
  • Does it help if you reinstall RubyMine? It could be some firewall issue or a networking problem. See if it helps if you start RubyMine from the Terminal: `open -a /Applications/RubyMine.app/`. – CrazyCoder Apr 24 '13 at 13:03
  • Firewall disabled, system restarted, started app from terminal, nothing gets debugging within the app to work. It's clearly a networking problem, but I content the problem is in RubyMine. Just how hard is it to write a client/server program that works on a UNIX derivative (Mac OS X)? Zillions of other software packages do this without RM's (notorious) failing in this regard. – Bogatyr Apr 24 '13 at 21:07
  • Make sure the [correct debug gem versions](http://stackoverflow.com/a/10325110/104891) are installed, try to reinstall them. – CrazyCoder Apr 24 '13 at 22:05
  • I've uninstalled and reinstalled gems and let RM install the debug gems. Everything except linecache I think. I'll try that one to be sure. But the fact that RM connects just fine to my manual rdebug-ide but can't connect to it's own launch of rdebug-ide, and that the RM debug console says "connected" while the RM dialog says "waiting for connection" to me points squarely to a RM problem. – Bogatyr Apr 25 '13 at 12:40
  • So far I didn't see similar complaints from other users and it works fine on my Mac as well. There is something specific to your system that breaks it. – CrazyCoder Apr 25 '13 at 15:51
  • @CrazyCoder google search reveals a plethora of RM debug problems. While I can't rule out "something specific to my system," I have made no system modifications that I know of other than installing software. A commercial product that ships on a platform should be able to anticipate and deal with likely problems. To turn it around, "no other software on my system has any problems with local network connections, except RubyMine, so there is something specific to RM that is failing." – Bogatyr Apr 25 '13 at 16:40

2 Answers2

6

Solved! My hostname was inexplicably set to "localhost". I changed it on the command line to be something else via

sudo hostname new-name

and the RubyMine debugger now connects and starts up immediately. Google indicates that having a hostname return "localhost" is a common Mac OS X condition. I would like to suggest to the JetBrains team to make a check for this and issue a warning notification to the user to avoid such problems on Mac OS X in the future. Or just to rewrite the internal debugger connection code so as not to be impacted by this condition. Thanks to CrazyCoder for the suggestions.

Bogatyr
  • 19,255
  • 7
  • 59
  • 72
  • @CrazyCoder I had read that (or a similar thread) before, and had already confirmed that System preferences/sharing/compute name was non-empty, but the problem still occurred. Running `hostname` from the shell did not return the name I had configured on preferences/sharing/name! It returned `localhost` instead. Only by running `sudo hostname new-name` did RubyMine debugging start working. – Bogatyr Apr 28 '13 at 13:33
  • @CrazyCoder it's completely reproducible: `sudo hostname localhost`: debugger can't connect. `sudo hostname new-name`, and the debugger connects fine. You might pass this to your OS X developers for further analysis. I'd be interested to hear what you find. – Bogatyr Apr 28 '13 at 13:35
  • Thanks for the details, created a new bug: http://youtrack.jetbrains.com/issue/RUBY-13585. – CrazyCoder Apr 28 '13 at 14:35
  • Thank goodness for this post. Saved me an unknown amount of time, but I had already spent 20 minutes + trying to figure this out. – sberry May 28 '13 at 18:19
  • hi, any idea how this could be done in windows? I don't think I've set up any 'localhost' hostname ever? – mickael Dec 01 '16 at 02:13
0

I've recently had the same problem in RubyMine 2022.1.3. (ruby-debug-ide 2.3.8, debase 2.3.8)

In my case, the problem was VPN (NordVPN in my case). Apparently, it was blocking the port or the connection entirely. Turning off the VPN fixed the debugger timeout.

dom
  • 414
  • 3
  • 12
  • Also had this on my office network, when I turned off wifi, I was able to connect to the debugger. – mfittko Oct 25 '22 at 15:17