redhat-developer / vscode-extension-tester

ExTester: Your Essential UI Testing Companion for Visual Studio Code Extensions! Seamlessly execute UI tests with Selenium WebDriver, ensuring robustness and reliability in your extension development journey. Simplify UI testing for your VS Code extensions and elevate the quality of your user interface effortlessly.
Apache License 2.0
262 stars 71 forks source link

WebDriverError: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) #214

Closed lhein closed 1 year ago

lhein commented 3 years ago

We are currently facing some errors in our build:

Please see the error ouput below. It does not happen on every build. See also https://app.circleci.com/pipelines/github/jboss-fuse/vscode-atlasmap?branch=pull%2F514

Writing code settings to /home/circleci/vscode-atlasmap/test-resources/settings/User/settings.json
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (337ms)
  2 failing

  1) "before all" hook in "{root}":
     WebDriverError: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/circleci/vscode-atlasmap/test-resources/VSCode-linux-x64/code is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}),platform=Linux 4.15.0-1077-aws x86_64)
      at Object.checkLegacyResponse (node_modules/selenium-webdriver/lib/error.js:546:15)
      at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:509:13)
      at /home/circleci/vscode-atlasmap/node_modules/selenium-webdriver/lib/http.js:441:30
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  From: Task: WebDriver.createSession()
      at Function.createSession (node_modules/selenium-webdriver/lib/webdriver.js:769:24)
      at Function.createSession (node_modules/selenium-webdriver/chrome.js:761:15)
      at createDriver (node_modules/selenium-webdriver/index.js:170:33)
      at Builder.build (node_modules/selenium-webdriver/index.js:642:16)
      at VSBrowser.<anonymous> (node_modules/vscode-extension-tester/out/browser.js:77:18)
      at Generator.next (<anonymous>)
      at fulfilled (node_modules/vscode-extension-tester/out/browser.js:5:58)

  2) "after all" hook in "{root}":
     TypeError: Cannot read property 'manage' of undefined
      at VSBrowser.<anonymous> (node_modules/vscode-extension-tester/out/browser.js:114:48)
      at Generator.next (<anonymous>)
      at /home/circleci/vscode-atlasmap/node_modules/vscode-extension-tester/out/browser.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/browser.js:4:12)
      at VSBrowser.quit (node_modules/vscode-extension-tester/out/browser.js:113:16)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:69:35)
      at Generator.next (<anonymous>)
      at /home/circleci/vscode-atlasmap/node_modules/vscode-extension-tester/out/suite/runner.js:8:71
      at new Promise (<anonymous>)
dcermak commented 3 years ago

Could you retry the test suite with vscode 1.50.0 or older? And did you by any chance introduce webpack or gulp recently?

jrichter1 commented 3 years ago

I've also added a launch argument to chromedriver that should help in some situations. It might not be enough, but it shouldn't hurt. Feel free to try it out in the new micro version.

apupier commented 3 years ago

And did you by any chance introduce webpack or gulp recently?

No

apupier commented 3 years ago

I've also added a launch argument to chromedriver that should help in some situations. It might not be enough, but it shouldn't hurt. Feel free to try it out in the new micro version.

Can you point to the launch argument and explain where to add it please?

Note that it doesn't happen all the time. It is random.

jrichter1 commented 3 years ago

Can you point to the launch argument and explain where to add it please?

It gets passed to chromedriver by extester, there is nothing for you to do. Just FYI, it's --disable-dev-shm-usage, apparently the most common solution to this problem.

apupier commented 3 years ago

Can you point to the launch argument and explain where to add it please?

It gets passed to chromedriver by extester, there is nothing for you to do. Just FYI, it's --disable-dev-shm-usage, apparently the most common solution to this problem.

it is still happenning: https://app.circleci.com/pipelines/github/jboss-fuse/vscode-atlasmap/137/workflows/d41ccd15-9161-4bb9-9423-ebcfc3580495/jobs/170

lakxraju commented 3 years ago

I am also facing the same error but only in WSL environment. In mac, it is working fine. Are there any fixes/workarounds found in the meantime?

apupier commented 3 years ago

up. This issue is still occuring several times per week.

jrichter1 commented 3 years ago

As discussed in #52 , it looks like on some CI systems chromedriver will have trouble launching if the binary is located on a sufficiently long path (and they don't need to be all that long for it to happen). It actually looks like a single path segment can make a difference.

Storing the test resources on a shorter path might help you here. There is a flag to specify just that -s path.

apupier commented 3 years ago

in https://github.com/redhat-developer/vscode-extension-tester/issues/52 , if I understand well, the failure appears all the time, not randomly. The path used seems to be relatively short already: /home/circleci/vscode-atlasmap/test-resources/VSCode-linux-x64/code it sounds like a different problem.

(issue is still happening from time to time, for instance https://app.circleci.com/pipelines/github/jboss-fuse/vscode-atlasmap/501/workflows/feef7a96-a475-437f-a233-ed1f15ad1a24/jobs/609 )

jrichter1 commented 3 years ago

Indeed this is a different issue than #52 . From the info I could find around the internet, the root cause is running chrome(driver) as a root user or using sudo. Even though chromium has two flags that supposedly work around this issue, both are being used by extension tester, and apparently to no success.

Are you by chance running any of the commands using sudo, or as a root user?

apupier commented 3 years ago

Are you by chance running any of the commands using sudo, or as a root user?

I'm sure that it is not using sudo. I do not think that it is the root user. i tis the user provided by the default image of Circle CI.

zhfnjust commented 2 years ago

same error:

image
sbobko commented 2 years ago

The same:

Launching browser... 1) "before all" hook in "{root}" 2) "after all" hook in "{root}"

0 passing (228ms) 2 failing

1) "before all" hook in "{root}": WebDriverError: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /home/sergey/repos/frameworks.ide.vscode.extensions.oneapi-gdb-debug/test-resources/VSCode-linux-x64/code is no longer running, so ChromeDriver is assuming that Chrome has crashed.) at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:522:15) at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:589:13) at Executor.execute (node_modules/selenium-webdriver/lib/http.js:514:28) at processTicksAndRejections (node:internal/process/task_queues:96:5)

2) "after all" hook in "{root}": TypeError: Cannot read properties of undefined (reading 'manage') at VSBrowser. (node_modules/vscode-extension-tester/out/browser.js:126:48) at Generator.next () at /home/sergey/repos/frameworks.ide.vscode.extensions.oneapi-gdb-debug/node_modules/vscode-extension-tester/out/browser.js:8:71 at new Promise () at __awaiter (node_modules/vscode-extension-tester/out/browser.js:4:12) at VSBrowser.quit (node_modules/vscode-extension-tester/out/browser.js:125:16) at Context. (node_modules/vscode-extension-tester/out/suite/runner.js:82:35) at Generator.next () at /home/sergey/repos/frameworks.ide.vscode.extensions.oneapi-gdb-debug/node_modules/vscode-extension-tester/out/suite/runner.js:8:71 at new Promise ()

Waiting for the debugger to disconnect...

SlyryD commented 2 years ago

Repro'd this by passing a relative path argument user-data-dir=./path/to/dir. Using absolute path worked user-data-dir=/abspath/to/dir

kiwi-bui commented 1 year ago

I am also experiencing this issue(tried on v4.3.0 and v5.2.1). Has anybody found a solution?

I am running this in a github action linux runner: extest get-vscode && extest get-chromedriver && extest install-vsix --extensions_dir ./test-resources/extensions --vsix_file ./dist/vscode-extension.vsix && extest install-from-marketplace --extensions_dir ./test-resources/extensions redhat.java vscjava.vscode-java-debug redhat.vscode-yaml && extest run-tests ./out/test/runPackageTests.js

I am getting essentially the same output:

Writing code settings to /home/runner/work/tanzu-developer-tools-for-vscode/tanzu-developer-tools-for-vscode/test-resources/settings/User/settings.json
Launching browser...
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (336ms)
  2 failing

  1) "before all" hook in "{root}":
     WebDriverError: unknown error: Chrome failed to start: crashed.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/runner/work/tanzu-developer-tools-for-vscode/tanzu-developer-tools-for-vscode/test-resources/VSCode-linux-x64/code is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
      at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:587:13)
      at Executor.execute (node_modules/selenium-webdriver/lib/http.js:515:28)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

  2) "after all" hook in "{root}":
     TypeError: Cannot read property 'manage' of undefined
      at VSBrowser.<anonymous> (node_modules/vscode-extension-tester/out/browser.js:126:48)
      at Generator.next (<anonymous>)
      at /home/runner/work/tanzu-developer-tools-for-vscode/tanzu-developer-tools-for-vscode/node_modules/vscode-extension-tester/out/browser.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/browser.js:4:12)
      at VSBrowser.quit (node_modules/vscode-extension-tester/out/browser.js:125:16)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:82:35)
      at Generator.next (<anonymous>)
      at /home/runner/work/tanzu-developer-tools-for-vscode/tanzu-developer-tools-for-vscode/node_modules/vscode-extension-tester/out/suite/runner.js:8:71
      at new Promise (<anonymous>)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tanzu@0.13.0 test-package: `npm run test-package-get-resources && npm run test-package-install-extension && extest run-tests ./out/test/runPackageTests.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the tanzu@0.13.0 test-package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2023-01-24T08_[46](https://github.com/vmware-tanzu/tanzu-developer-tools-for-vscode/actions/runs/3994410146/jobs/6852088986#step:21:47)_21_[63](https://github.com/vmware-tanzu/tanzu-developer-tools-for-vscode/actions/runs/3994410146/jobs/6852088986#step:21:64)4Z-debug.log
kiwi-bui commented 1 year ago

Repro'd this by passing a relative path argument user-data-dir=./path/to/dir. Using absolute path worked user-data-dir=/abspath/to/dir

What are you passing this argument to?

Ullises commented 1 year ago

Hi, I'm also getting the same issue as the last posted here, any suggestion?

image
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

infiniteregrets commented 1 year ago

experiencing the same issue, except it Error: Server terminated early with status 2

Writing code settings to /home/runner/work/mirrord/mirrord/vscode-ext/out/storage/settings/User/settings.json
Launching browser...
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (25ms)
  2 failing

  1) "before all" hook in "{root}":
     Error: Server terminated early with status 2
      at /home/runner/work/mirrord/mirrord/vscode-ext/node_modules/selenium-webdriver/remote/index.js:260:24
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  2) "after all" hook in "{root}":
     TypeError: Cannot read properties of undefined (reading 'manage')
      at VSBrowser.<anonymous> (node_modules/vscode-extension-tester/out/browser.js:129:48)
      at Generator.next (<anonymous>)
      at /home/runner/work/mirrord/mirrord/vscode-ext/node_modules/vscode-extension-tester/out/browser.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/browser.js:4:12)
      at VSBrowser.quit (node_modules/vscode-extension-tester/out/browser.js:128:16)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:82:35)
      at Generator.next (<anonymous>)
      at /home/runner/work/mirrord/mirrord/vscode-ext/node_modules/vscode-extension-tester/out/suite/runner.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/suite/runner.js:4:12)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:80:24)

ci run: https://github.com/metalbear-co/mirrord/actions/runs/5204141829/jobs/9388134176

djelinek commented 1 year ago

Duplicates #485