lloiser / go-debug

🐛 A go debugger for atom using delve.
https://atom.io/packages/go-debug
MIT License
388 stars 21 forks source link

Stop button not working #92

Open neclepsio opened 7 years ago

neclepsio commented 7 years ago

In version 1.3.1, when I click the stop button, after a couple of times of correct behaviour, it stops working. The interface changes, but the process is not killed. So, then I hit the launch button again, I get:

Starting delve with config "Debug"
Failed to start delve with config "Debug"
  Error: Error: Already debugging!
lloiser commented 7 years ago

It seems there was an issue in go-debug. Please open the developer tools of atom using the Toggle Dev Tools command and check the Console tab for errors/warnings if this happens again. Can you also provide the code that caused this problem?

neclepsio commented 7 years ago

I could not reproduce under Windows, but only under Ubuntu 16.10. There are no warnings. What do you mean by "the code that caused the problem"?

neclepsio commented 7 years ago

I add the problem is really the stop button not working: if I kill the debug process, it works again. Another thing: how can I debug the problem is not in delve itself?

lloiser commented 7 years ago

You can try to run delve in your terminal/bash too. just cd to your package folder and run dlv debug. Have a look at https://github.com/derekparker/delve/tree/master/Documentation/usage to see how to use dlv.

neclepsio commented 7 years ago

I tried but I don't know how to simulate what go-debug does to stop the execution.

neclepsio commented 7 years ago

I also noticed clicking on play does not pause the execution. I'm using the default "debug" configuration. Is there a way to revert to previous version? Thank you.

lloiser commented 7 years ago

Sry but I'm still not able to reproduce this problem. Do you have some golang code that you can share with me that causes this problem? Or at least provide some information about the code. e.g. is it a http server you are starting? (this already caused some problems in the past)

Yes, you can downgrade go-debug but I highly suggest not to do it.

apm uninstall go-debug
apm install go-debug@<package_version>
neclepsio commented 7 years ago

The code is very big and cannot be shared. Yes, I'm starting a http server. I also reinstalled everything from scratch. I will try again to debug the plugin on Linux in the weekend.

In the meantime: is pausing the execution supported? I have a deadlock somewhere in my code, and I really would need to pause when locked to inspect who is waiting what. I was expecting the "play" button became a "pause" during execution, like a lot of debuggers. I can't find this feature in the plugin code. Should I open a separate bug?

lloiser commented 7 years ago

is pausing the execution supported

No. I have tried to implement this a while ago but it wasn't working. Please open another issue for this maybe things have change in the meanwhile :), thx.

lloiser commented 7 years ago

I finally reproduced this! It happens if you have an http server (or some other kind of long running function) and hit continue in the debugger. So the debugger basically now runs forever. Now try to add a new breakpoint. It's actually not added because the debugger is currently busy running the actual program. Now click stop. Instead of correctly shutting down, go-debug remains in a weird state. I will see what I can do now.

cleanunicorn commented 7 years ago

Sometimes it happens without setting breakpoints while it is running also