Reputation: 976
Im struggling since yesterday with a totally weird problem which occurs out of the nowhere. I'm working with PHPStorm in a Symfony Project. PHPUnit Tests are running as usual. If i activate the listening mode in the IDE for debugger connections and run the tests phpunit freezes and the IDE stops automatically after 30seconds. I think it has nothing to do with the ide. If i use MacGDBp i'm experiencing the same. I've checked all Firewall related stuff on my OSX 10.11 and installed php in a new Brew environment. PHP is Version 5.6 from the local OSX and from Brew.
I'm fairly blind without an debugger :-o
Upvotes: 7
Views: 2698
Reputation: 24043
For me, the cause was @runTestsInSeparateProcesses
.
Here was the symptom: when I turn on debugging in Netbeans and then run export XDEBUG_CONFIG="idekey=netbeans-xdebug remote_connect_back=0 remote_host=10.0.2.2"
and then phpunit tests/Unit/MarkAsScheduledUnitTest.php --filter=testHandleExceptionWithMocking
, it just outputs "PHPUnit 7.1.2 by Sebastian Bergmann and contributors." and a blinking cursors and hangs there. When I go into Netbeans and quit the debugging, the phpunit test then runs.
The solution was so temporarily remove @runTestsInSeparateProcesses
any time I'm running just that one test or class of tests (rather than the whole suite of tests).
https://stackoverflow.com/a/37464247/470749 explains why I'm using @runTestsInSeparateProcesses
at all.
Xdebug breakpoints always work except when using @runTestsInSeparateProcesses? is giving me ideas for how to more easily run a single test without temporarily removing @runTestsInSeparateProcesses
.
Upvotes: 1
Reputation: 1343
Xdebug can only listen to one running PHP process at a time. There are usually two possibilities for this.
1) As @adrianGW says, there could be another process already attached to the debugger.
2) Your program tries to load another PHP process and that process can't start until xdebug releases the current thread. This is common that PHPunit will run tests in their own threads so they don't mess up each others envs. Or your are making an http request in your application to a php script on the same server, and that second request is waiting for the first to finish so you are locked until the first script times ou
There are two fixes in PHPstorm:
1) You can change Max Simultaneous Conections
to a number greater than 1
2) You can enable Ignore external connections through unregistered servers configurations
, but this will only work if the reason for the additional threads is something like a request to another domain on the same server, which xdebug can differentiate as an unregistered server.
Upvotes: 0
Reputation: 2265
Make sure you don't already have another debug session running in the background.
Upvotes: 1