Running into deadlock when using XDebug with Drush For most of the Drush commands it is not too difficult to get XDebug and Drush working togethr and catch staff in your IDE, e.g. PhpStorm.

However, I ran into a deadlock when Drush is calling itself for a sub-process. This happens e.g. if you execute drush @site updatedb because this will invoke a second PHP task for the cache-clear all command. This second PHP task wants to connect to the Xdebug port as well which is still in use by the parent PHP task. This results in a deadlock: the child is waiting for the XDebug port to become available and the parent task is waiting for the child task - for ever or until Ctrl-C.

Is there a way around this?
In PhpStorm at least, under File >> Settings >> PHP >> Debug you can find Max. simultaneous connections and crank it up. I typically keep it at 8 but probably 3 is enough.