How to fix curl_exec call hanging when Xdebug is enabled How to fix curl_exec call hanging when Xdebug is enabled docker docker

How to fix curl_exec call hanging when Xdebug is enabled


After following @LazyOne advice I looked at the Xdebug logs more closely and noticed the hanging was occurring after a successful xDebug connection was made. This lead me to two possible causes; some rouge breakpoint that was not getting registered in the PhpStorm Debug tool window or something on the site was delaying the response.

So I did the following:

  1. Removed all PhpStorm Debug breakpoints in the application and restarted PhpStorm.
  2. Realized the Automatic Cron setting in Drupal 7 Configuration was set to run every 1 Day so switched it to Never. My thinking was possibly the execution of Drupal Cron was getting stuck and not completing so every HTTP request was hanging.

It worked and now I wish I had tested each of these steps separately because I don't know which one exactly was the solution. I am leaning towards #1 because when I switched off debugging in PhpStorm the Behat test would execute with no delay. Either way, if you have a similar issue try both of the above.