Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to chrome error (ember exam --parallel) #40

Closed
joshuaswift opened this issue Mar 29, 2021 · 8 comments
Closed

Unable to connect to chrome error (ember exam --parallel) #40

joshuaswift opened this issue Mar 29, 2021 · 8 comments

Comments

@joshuaswift
Copy link

Hi! Just installed this addon in our app but we currently get this error after we run tests every time. This happens if we run the tests locally or on our CI.

Any ideas what could be causing it?

Thanks!

image

This is our test script:
"test": "percy exec -t 250 -- ember exam --random=10 --split=16 --parallel",

This is our testem config:

/* eslint-env node */
module.exports = {
  framework: 'qunit',
  test_page: 'tests/index.html?hidepassed',
  disable_watching: true,
  reporter: Reporters,
  report_file: './reports/test-results.xml',
  xunit_intermediate_output: true,
  launch_in_ci: ['Chrome'],
  launch_in_dev: ['Chrome'],
  browser_start_timeout: 10,
  socket_heartbeat_timeout: 10,
  browser_disconnect_timeout: 10,
  browser_reconnect_limit: 10,
  parallel: 16,
  browser_args: {
    Chrome: {
      dev: ['--remote-debugging-port=9222'],
      ci: [
        '--disable-dev-shm-usage',
        '--disable-gpu',
        '--disable-software-rasterizer',
        '--disable-web-security',
        '--headless',
        '--incognito',
        '--mute-audio',
        '--no-sandbox',
        '--remote-debugging-address=0.0.0.0',
        '--remote-debugging-port=9222',
      ],
    },
  },
};
@steveszc
Copy link
Owner

Your remote-debugging-address flag looks suspicious. I haven't seen that before and haven't tested the addon with that flag present. I would try removing that.

The error you got indicates that we connencted to a chrome instance over port 9222, but there were no tabs running in that instance. Is it possible you have multiple instances of chrome running with a remote debugging port?

@steveszc
Copy link
Owner

Also, have you tried running with a simpler ember test or ember test --server to see if the same issue occurs? I'm especially curious about ember test --server since that will use the dev browser args in your testem config instead of the ci args.

@steveszc
Copy link
Owner

steveszc commented Mar 31, 2021

It very well could be an issue with ember exam's parallel flag. I assume the parallel arg will cause testem to boot up multiple chrome instances all running on the same remote debugging port. When the addon attempts to connect to chrome to capture a heap snapshot, it will just be luck-of-the-draw deciding which chrome instance we actually connect to.

In order for this to work properly we need to make sure that every instance of chrome is running on a unique debugging port which would take some coordination between the addon config, the testem config, and ember exam. This is going to be tricky to solve, and nothing is coming to mind immediately.

@steveszc steveszc changed the title Unable to connect to chrome error Unable to connect to chrome error (ember exam --parallel) Mar 31, 2021
@cjsissingh
Copy link

cjsissingh commented Mar 31, 2021

I have the same problem using ember test and ember test --serve.

I installed ember-cli-memory-leak a few months ago and it worked fine. Tried again today (after your ember-conf talk) and starting to see this error. I have tried to install older version 0.5.0 and got the same result, so I'm not convinced it's anything you've changed. I'm just not sure where to look next.

ember-cli-memory-leak-detector: Error: Unable to connect to chrome. Error: Tab titled "✔ ReconzUser Tests (338/338)" did not match any of: "✖ ReconzUser Tests (936/937)"

The "did not match any..." name doesn't appear to change even after applying a --filter like I did to get the error above.

@joshuaswift
Copy link
Author

joshuaswift commented Apr 1, 2021

@steveszc I tried removing remote-debugging-address flag and running ember test --serve but same error unfortunately. Running the tests in parallel does seem like it would cause problems but weird that it still happens with the regular ember test command.

@steveszc
Copy link
Owner

steveszc commented Apr 1, 2021

The did not match any of: part of the error lists all the tab titles found in the chrome instance we connected to. So this is indicating that we have successfully connected to chrome over the remote debugging port, but we're not seeing the tab that is actually running our tests. This indicates that there are multiple instances of Chrome running with the same remote debugging port open, and we happened to connect to the wrong instance. This could be true of both case, either when there is a mismatched title or no title.

It's possible that there is a headless instance of chrome "invisibly" hanging around after one of these unsuccessful attempts. I remember running into a similar issue a few times while I was building the addon.
You could try restarting your machine, or kill all chrome instances in your process manager, and then try again.

@cjsissingh
Copy link

cjsissingh commented Apr 6, 2021

You could try restarting your machine, or kill all chrome instances in your process manager, and then try again.

This worked for me. Thanks @steveszc!

@joshuaswift
Copy link
Author

You could try restarting your machine, or kill all chrome instances in your process manager, and then try again.

This worked for me. Thanks @steveszc!

This also worked for me locally, thanks!

@steveszc steveszc closed this as completed Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants