Stopping debugging doesn't end process most of the time?

A lot of the time when I run a debug configuration for a PHP file and end it by clicking the stop button it doesn't kill the process. The debugger will show it as stopped (the run button becomes available and the stop button is grayed out), but the process is still running and output from the script is still shown in the console tab. I have to manually go into Task Manager and kill the process.

I'm runnning PhpStorm 8.0.3 on Windows 10 x64.

Is this expected behavior or a bug?

6 comments
Comment actions Permalink

Hi there,

1) Is it a local CLI script debug .. or another one (e.g. via browser)?
2) Are you clicking "stop" when script is actually running .. or when it waiting for your reaction (e.g. when you stopped at breakpoint etc).

  • If when running -- it's kind of expected as debugger communicates with client (PhpStorm in our case) only during those "waiting for instructions" pauses (keep in mind that it's debugger who establishes connection to IDE and not other way around).
  • If second -- please provide xdebug logs (to see if it receives such instructions or not).
0
Comment actions Permalink

>> 1) Is it a local CLI script debug .. or another one (e.g. via browser)?


I'm debugging by right clicking on the file name in PhpStorm and choosing Debug.

>> Are you clicking "stop" when script is actually running .. or when it waiting for your reaction (e.g. when you stopped at breakpoint etc).

When the script is actually running, not at a breakpoint.

I'm trying to debug a websocket server which runs continuously until killed, so having to go into task manager every time I want to stop the script gets pretty old. Is there any way to have PhpStorm kill the script when the stop button is pressed?
0
Comment actions Permalink

>> 1) Is it a local CLI script debug .. or another one (e.g. via browser)?


I'm debugging by right clicking on the file name in PhpStorm and choosing Debug.

This does little help - based on your exiting configuration it could be any type of Run/Debug config.

Therefore -- "Run | Edit Configurations...", find yours for this script and see what type it is (post a screenshot in unsure).

Is there any way to have PhpStorm kill the script when the stop button is pressed?

If it's a web-based debug then none -- debugger communicates with IDE only when waiting for instructions ( https://youtrack.jetbrains.com/issue/WI-1699#comment=27-149841) -- xdebug does not support async commands ( http://bugs.xdebug.org/view.php?id=574 )

For CLI -- in theory it could be able to kill such script (actual force "kill" as PhpStorm is the one that launches it so can have full control over child process) but does not -- it can only "detach" leaving script running. Obviously, when it's waiting for instructions, it can terminate script.

---

To sum it up: IDE cannot kill the script if debugger (xdebug in particular) is not in interactive/"waiting for instaructions" mode.

0
Comment actions Permalink

Here's a screenshot:

http://imageshack.com/a/img673/4703/nhKvuD.png

0
Comment actions Permalink

That's a local CLI script (as it's located under "PHP Script" branch) -- it's not a permanent entry .. but that does not matter in current situation.

I may only suggest to submit new ticket to the Issue Tracker asking to implement such feature for local CLI scripts (I believe that it's possible to do that).

There were some similar tickets already in the past ... but some of them (e.g. WI-21038) were marked as duplicates of WI-8101 -- not sure how correct is that though. Still -- better to have new ticket (especially if you will actually ask to "force kill local CLI script" and not generic "kill script when exiting debugging" as it's simply not possible (at least with xdebug)).

0
Comment actions Permalink

Hi,
If you are sitting on a socket, the thread you can be in a TIMEWAIT state on the socket close.  If you do a fstart and grep on the port you will see the waiting tasks.

Jim

0

Please sign in to leave a comment.