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
Cypress could not connect to Firefox. Error: cannot open socket
displayed at beginning of running spec
#6392
Comments
Apart from this: fantastic that you are working on the Firefox option! |
Yes, confirmed on 4.0.1, firefox execution halts between first and second spec. |
I have not been able to reproduce this exactly as described, where it throws this message in between the first and second spec. I tried with I can get this to happen for several of the reasons that were happening before for me as described in #6380, but these always fail at or before the first spec file run for me. (also, I can't get these to reproduce in #6400, so I think it's been fixed). This may be fixed as part of this PR: #6400 There are instructions for pulling down and running the fixes from this PR here: 3007c4f#commitcomment-37216685 If you can pull that down, let us know if that fixes your issue. Also:
|
The answer to both questions is 'no'.
The number of remaining Firefox processes have doubled. Running a spec with headless chrome I see all chrome processes are neatly cleared after the run. Did not have the opportunity yet to try fix #6400 |
A bit off-topic (but related, since I would like to try out #6400): |
Unfortunately #6400 did not bring the solution :(
|
This may not be linked, or may assist with investigation but I found the following behaviour when using the Test Runner with Firefox: 1 - Select to run spec file A |
Above log by running in MAC with only one spec. Any solution? |
This should be fixed in #6400. In the meantime, you can pass |
still having the issue, even after #6400 |
Option |
+1 - #6400 doesn't fix it as stated above. Firefox stays open at end of run and a dialog pops up stating something about needing to close the browser to continue (sorry don't have a screenshot handy). This happens locally on Windows 10 environment as well as in CI |
I observed the similar issue with firefox. I have test in the gitlab, both chrome and firefox using the imge cypress/included:4.1.0. Test usually takes about 4-5 minutes to finish. However, running the test with firefox 'yarn cypress:run --headless --browser firefox' hangs at the last spec until 1 hour limit of the gitlab. |
This PR above did fix some occurances of this issue, but likely there is something else specific to the config, environment or tests that we will need to isolate.
Edit: Actually, I would really like to ensure that the module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
console.log('LAUNCH OPTION ARGS', launchOptions.args) // print all current args
})
} When I run this - it prints the below. |
For me at least this is the details I can share
Edit: |
I can confirm that this still happens. Versions Command Launch options
cypress.json {
"video": false
} support/index.js const resizeObserverLoopErrRe = /^ResizeObserver loop limit exceeded/;
Cypress.on("uncaught:exception", err => {
if (resizeObserverLoopErrRe.test(err.message)) {
return false;
}
});
Cypress.Screenshot.defaults({
screenshotOnRunFailure: false
}); |
Did anyone found a workaround for this issue? Happens to me as well firefox instance is not being close after first spec |
I have the same issue in Jenkins trying to run in parallel Jenkinsfile: pipeline {
agent {
docker {
image 'cypress/browsers:node13.6.0-chrome80-ff72'
args '-p 3000:3000'
}
}
stages {
stage('Install Dependencies') {
steps {
sh 'npm ci'
sh 'npm run cy:verify'
}
}
stage('parallel tests E2E') {
parallel {
stage('Firefox') {
steps {
sh "npm run cy:run:firefox"
}
}
stage('Chrome') {
steps {
sh "npm run cy:run:chrome"
}
}
}
}
}
} package.json "cy:verify": "cypress verify",
"cy:run:chrome": "cypress run --spec \"**/*.feature\" --browser chrome --headless",
"cy:run:firefox": "cypress run --spec \"**/*.feature\" --browser firefox --headless" Firefox options
But if I only run the Firefox browser, everything works fine : pipeline {
agent {
docker {
image 'cypress/browsers:node13.6.0-chrome80-ff72'
args '-p 3000:3000'
}
}
stages {
stage('Install Dependencies') {
steps {
sh 'npm ci'
sh 'npm run cy:verify'
}
}
stage('Firefox') {
steps {
sh "npm run cy:run:firefox"
}
}
}
} |
Same issue occurs in Github Actions as well. Firefox execution hangs forever, until cancelled manually. Firefox cypress prefs: [
'-marionette',
'-new-instance',
'-foreground',
'-start-debugger-server',
'-no-remote',
'-headless'
] Actions yml file firefox:
runs-on: ubuntu-16.04
container:
image: cypress/browsers:node12.13.0-chrome80-ff74
options: --user 1001
steps:
- uses: actions/checkout@v1
- name: npm install
run: |
npm install
- name: npm run
run: |
nohup npm start &>/dev/null &
- name: cypress firefox all test
run: |
npm run test:firefox |
any update on this? we get the same issue when running cypress within the azure devops pipeline, using firefox browser |
Still existing in 4.4.0 |
There are no updates on this issue. An issue will be closed when it is fixed with a comment on what version it's released in. There's no need to comment asking for updates if neither of these actions is taken. |
I have the same issue with cypress 4.5.0 running on Linux on a Microsoft hosted agent in Azure Devops. Edit: I have this when trying to two runs in the same job, so first for chrome then for Firefox. If I run only for firefox it works, so it seems there is something not closed properly from the first run. |
Doing like @Evertvdw mentioned worked for me as well. |
Adding to what @Evertvdw said - Environment: GitHub Actions, ubuntu-latest runner. |
I noticed also that, when I run the Firefox tests in its own Weird (and limiting) behaviour... |
Update I believe I'm also hitting this issue. The Firefox run worked for me a few times, but now consistently fails. Environment:
I have two separate jobs in my pipeline, one for FF and one for Chrome. Oddly enough the FF job just hangs at the end even though it shows it failed. I can then exec into the pod and run commands. I've re-run the This happens consistently and I can pass the debug flag, so happy to provide any additional information if needed. Excerpt of the final messages on the failed run:
|
I am able to reproduce the timeout connecting to the second launch of Firefox on Windows, but I only ever get the Let's limit discussion in this issue to the bug affecting Windows users only, where Cypress will fail to launch the second spec file because of an "Error: cannot open socket" error. @arvinder06 @chengzh2008 @Guusy @mtayfur-pointr @khitrenovich @mvn-srizzari Discussion about intermittently encountering "Error: cannot open socket" upon launching the first spec file (which I believe all of you are experiencing) can be moved to this issue: #7159
@arvinder06 Are you truly using Firefox 9? Try upgrading to the latest version, it's unlikely that a version that old will work. |
Maybe it will help someone.
I know that it is ugly, but I had to make it work. |
When I try running my test in firefox (both in test runner and command line) I get the following error Error: connect ECONNREFUSED 127.0.0.1:52415 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14). I have tried upgrading my firefox version (Currently on 56.0) and updating my cypress (4.8.0). I am running my test on windows 10. I think this may be a similar issue? Fixed this by upgrading firefox to 77.0.1. |
I liked your idea of killing the instances by writing some custom script which would atleast serve as a workaround until it is fixed by cypress team. Thanks, |
@bhaskerchari not able to share code (company rules). |
I am more of interest in what is the event or hook that you have used when you say after every spec you are invoking "npm run killFirefoxWin" Actually I am using JS and I have tried running the custom script in after () callback of every spec using cy.exec() but it didn't help so that's why interested in where you have invoked the custom script to kill firefox process. |
The code for this is done in cypress-io/cypress#7106, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
When running cypress with options '--headless --browser firefox', cypress halts at the start of the second spec with message:
This blocks running all specs in 'run' mode
Windows 10, Firefox version 72 (64 bit)
The text was updated successfully, but these errors were encountered: