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

Cannot interrupt program execution from remote control interface #239

Closed
izaera opened this issue Apr 18, 2016 · 10 comments
Closed

Cannot interrupt program execution from remote control interface #239

izaera opened this issue Apr 18, 2016 · 10 comments

Comments

@izaera
Copy link

izaera commented Apr 18, 2016

After sending PR #238 to fix remote debugging, I still cannot interrupt program execution from the remote control interface.

I'm starting a simple Ruby script that loops forever with a 5 second delay per loop and a calls 'puts' with the loop count. I run it with remote byebug and I connect to the debugging remote and control ports. Everything looks fine, but when I issue an interrupt command in the control port while the program is running, it replies that Byebug has not been started yet.

I'm not sure what this means. If it cannot be fixed now, any hint on how to continue diagnosing/fixing this will be appreciated.

Thanks in advance.

@deivid-rodriguez
Copy link
Owner

@izaera Thanks for the report and sorry for not replying to your emails soon enough, I don't have a lot of time for this... :(

Unfortunately, remote debugging (and thus integrations) are currently the weakest part of byebug. It was ported from original debugger, but it has only minimal tests and I haven't really never used it, so it's been always mantained by the community from the beginning.

One question, does remote debugging work properly and is it only the interrupt command failing?

Regards!

@izaera
Copy link
Author

izaera commented Apr 19, 2016 via email

@izaera
Copy link
Author

izaera commented Apr 19, 2016

Just a hint: the problem seems to be an exception when Byebug.thread_context is called in:

https://github.com/deivid-rodriguez/byebug/blob/master/lib/byebug/commands/interrupt.rb#L27

AFAIK, that is a native method so I had to stop debugging there. I may try to add some traces to the native code, but I have to setup a proper compilation environment, so I have to get some spare time.

@izaera
Copy link
Author

izaera commented Apr 26, 2016

More info about this. Behaviour has changed after #242

Using the code from that PR in local as my byebug gem, I have done the following:

  1. Start the following script:
#!/usr/bin/env ruby
require 'byebug'
require 'byebug/core'
Byebug.wait_connection = true
Byebug.start_server('localhost', 1234)

i = 0
loop do
  puts i
  i += 1
  sleep 2
end
  1. Connect with telnet to control port (1235) -> I get the PROMPT (ctrl)
  2. Connect with telnet to remote port (1234) -> The program starts
  3. Type interrupt + CR in control port -> the program pauses and I get the PROMPT (byebug) in remote port
  4. Type continue in remote port -> the program restarts
  5. Type interrupt + CR in control port -> I get the reported error

So I can interrupt the program just once. Before my PR -or some other change I'm not aware of- I couldn't even interrupt the program once.

@angelovAlex
Copy link

The same issue happens to me :( Very sad that there's no normal way to debug ruby code.. seems like ruby is not a good solution for new projects

@deivid-rodriguez
Copy link
Owner

@izaera I'm pretty sure you no longer use ruby, but I'm letting you know that this should be fixed by #406, just in case!

@angelovAlex
Copy link

Glad to hear it. I never stop to use ruby, as it's still my favorite. I was in bad mood when I wrote last comment, as I was writing a gui for the debugger and had to stop the project because of this bug.

@deivid-rodriguez
Copy link
Owner

@angelovAlex Glad to hear that you still use Ruby! Maybe you can resume your work on that GUI now 😄

@izaera
Copy link
Author

izaera commented Jan 8, 2018

@deivid-rodriguez Yes, you are right: I don't use Ruby any more because I changed job. However, my Atom debugger was half developed so, if anyone wants to continue it, he/she is welcome. Thx for the info :-).

@deivid-rodriguez
Copy link
Owner

Thanks for the heads-up, @izaera! :)

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

3 participants