acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

BLT-5209: [info] Waiting for non-50x response from http://localhost:9222... #4672

Open neelkhatri opened 1 year ago

neelkhatri commented 1 year ago

Describe the bug After upgrading to BLT 13.7.0 and Drush 11.5.x I am facing issue with my ci pieline. I am seeing "[debug] cURL error 7: Failed to connect to localhost port 9222: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)  [info] Waiting for non-50x response from http://localhost:9222/..." error during CI build after behat test triggered.

To Reproduce Steps to reproduce the behavior, ideally starting from a fresh install of BLT:

  1. Run composer create-project acquia/drupal-recommended-project --no-interaction
  2. After installing Drupal 9.5.7, BLT 13.7.0 and drush 11.5.x
  3. run blt tests:behat --no-interaction --define drush.alias='${drush.aliases.ci}' --define tests.run-server=true -v
  4. See error

Expected behavior It should run ci pieline without any error

Detailed error output

Run All Tests

$COMPOSER_BIN/blt tests:behat --no-interaction --define drush.alias='${drush.aliases.ci}' --define tests.run-server=false --define environment=ci -v [info] Running command /builds/ito-ms/applications/website-factory/drupal/repo/vendor/bin/drush @self status bootstrap BLT can (re)generate tests/behat/local.yml using tests/behat/example.local.yml. [warning] Required file /app/docroot does not exist. [warning] Behat is not configured properly.

tests:behat:init Generating Behat configuration files... [Filesystem\FilesystemStack] mkdir ["/builds/ito-ms/applications/website-factory/drupal/repo/reports"] [info] Killing running google-chrome processes... [info] Killing all processes on port '9222'... [info] Launching headless chrome... 'google-chrome' --headless --disable-web-security --no-sandbox --disable-gpu --disable-extensions --start-maximized --remote-debugging-port=9222 --window-size='1366,768' http://localhost/ -vvv Deprecation Warning: this command is passing a command string and should pass a command array. [Robo\Common\ProcessExecutor] Running ''\''google-chrome'\''' '--headless' '--disable-web-security' '--no-sandbox' '--disable-gpu' '--disable-extensions' '--start-maximized' '--remote-debugging-port=9222' '--window-size='\''1366,768'\''' 'http://localhost' '-vvv' in /builds/ito-ms/applications/website-factory/drupal/repo [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Waiting for non-50x response from http://localhost:9222/... [info] Killing running google-chrome processes... [info] Killing all processes on port '9222'... [error] Timed out.

with debug mode it is showing some curl 7 error "[debug] cURL error 7: Failed to connect to localhost port 9222: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)"

image

System information

Additional context Add any other context about the problem here.

loopy3025 commented 1 year ago

I had this issue when running source ${BLT_DIR}/scripts/pipelines/tests on a big, nasty site that takes a lot of time to spin up in the Pipelines CI.

The issue might be occuring for me because I am trying to use the script in a non-standard way; we are calling it during setup-env. I really need the database to sync for the tests, though, and blt drupal:sync:default:site doesn't seem to want to work during the tests step.

At any rate, the following patch to blt stops the wait and will at least get you past that point so that you can troubleshoot...

diff --git a/vendor/acquia/blt/src/Robo/Common/Executor.php b/vendor/acquia/blt/src/Robo/Common/Executor.php
--- a/vendor/acquia/blt/src/Robo/Common/Executor.php
+++ b/vendor/acquia/blt/src/Robo/Common/Executor.php
@@ -181,7 +181,7 @@ public function killProcessByName($name) {
    *   The URL to wait for.
    */
   public function waitForUrlAvailable($url) {
-    $this->wait([$this, 'checkUrl'], [$url], "Waiting for non-50x response from $url...");
+    // $this->wait([$this, 'checkUrl'], [$url], "Waiting for non-50x response from $url...");
   }

   /**

It's possible, however, that you really do need that wait time, so if your scripts are failing partially at the beginning, instead of removing the wait, you can replace it with a custom sleep() time that works for your application...

diff --git a/vendor/acquia/blt/src/Robo/Common/Executor.php b/vendor/acquia/blt/src/Robo/Common/Executor.php
--- a/vendor/acquia/blt/src/Robo/Common/Executor.php
+++ b/vendor/acquia/blt/src/Robo/Common/Executor.php
@@ -181,7 +181,7 @@ public function killProcessByName($name) {
    *   The URL to wait for.
    */
   public function waitForUrlAvailable($url) {
-    $this->wait([$this, 'checkUrl'], [$url], "Waiting for non-50x response from $url...");
+    sleep(60);
   }

   /**

I did try adding set_time_limit(0); before the $this->wait(), but that didn't seem to have any effect. I've done extensive searching and can find no mention of how to generally increase the wait time for BLT. It would be nice if this was a setting I could add to blt.yml instead of having to add a wonky patch.

So I guess that's the real question. Is there, during Acquia Pipelines CI, a way to increase the amount of time or attempts that executor waits before crapping out?

joewhitsitt commented 1 year ago

We experienced something similar with Travis CI and had to change our ubuntu distro to focal from xenial as recent Chrome versions have had a mismatch for some dependencies.

mikemadison13 commented 1 year ago

I've run into this issue intermittently as well, and the above solution to comment out the wait method has fixed the issue for me when necessary. it doesn't "always" happen but when it does, that's how i've worked around it.

FYI this can also sometimes indicate a php fatal error somewhere (and commenting out the wait time can expose that in your CI logs).

mikemadison13 commented 1 year ago

can you confirm you have a ci.blt.yml file? see https://github.com/acquia/blt/pull/4489 for getting that added by default (it was missing for a while).

see https://github.com/acquia/blt/issues/4011 for my original issue from a couple of years ago on this broader topic.