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

Cannot read property isAttached of undefined #6813

Closed
EtienneBruines opened this issue Mar 23, 2020 · 13 comments · Fixed by #8040 · May be fixed by Omrisnyk/npm-lockfiles#145
Closed

Cannot read property isAttached of undefined #6813

EtienneBruines opened this issue Mar 23, 2020 · 13 comments · Fixed by #8040 · May be fixed by Omrisnyk/npm-lockfiles#145

Comments

@EtienneBruines
Copy link

EtienneBruines commented Mar 23, 2020

Current behavior:

Cypress does NOT work for Firefox 75.

  1) Receiving a project-message "before each" hook for "when multiple tabs are open":
     TypeError: Cannot read property 'isAttached' of undefined

Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'Receiving a project-message'
      at /home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/lib/browsers/firefox-util.js:98:20
      at tryCatcher (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
      at /home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:15:34
      at /home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/lib/browsers/firefox-util.js:227:40
      at tryCatcher (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
      at _drainQueueStep (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
      at _drainQueue (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/home/etiennebruines/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:439:21)

Desired behavior:

No errors.

Test code to reproduce

Any test consisting of more than one it-clause. Firefox crashes upon GC collection afterwards.

Currently there's no Firefox 75-Cypress-docker image available yet, so no forked test was linked.

Example:

/// <reference types="cypress" />
describe('page', () => {
  it('works', () => {
    cy.visit('https://example.cypress.io')
  })
  it('still works', () => {
    cy.visit('https://example.cypress.io')
  })
})

Versions

  │ Cypress:    4.2.0                                                                             
  │ Browser:    Custom Firefox Developer Edition 75 (headless)       
 OS: Linux-based
@jennifer-shehane jennifer-shehane added v4.0.2 🐛 Issue present since 4.0.2 browser: firefox labels Mar 24, 2020
@cypress-bot cypress-bot bot added the stage: needs investigating Someone from Cypress needs to look at this label Mar 24, 2020
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 24, 2020

Yes, I can confirm this is happening

  • ❗️Fails in Firefox Develop Edition 75.0b7.
  • ✅Passes in Firefox 72.0.2
  • ❗️Fails during cypress run (headless or headed) - notably this is because runMode auomatically has gcInterval set.
  • ✅Passes during cypress open
  • ❗️Fails when visiting a URL
  • ✅Passes with standard expect assertion without cy.visit()
  • ↺ Test just hangs forever in Cypress 4.0.0-4.0.1
  • ❗️Fails in Cypress 4.0.2+

The error is throwing here:

https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/browsers/firefox-util.ts#L57:L57

Full callstack

TypeError: Cannot read property 'isAttached' of undefined
    at /Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/firefox-util.js:98:20
    at tryCatcher (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:15:34
    at /Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/firefox-util.js:227:40
    at tryCatcher (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/jennifer/Library/Caches/Cypress/4.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21)

Workaround

You can set firefoxGcInterval to null for runMode. Note this may have other unintended consequences. Please see our full explanation of firefoxGcInterval here: https://on.cypress.io/configuration#firefoxGcInterval

In configuration file - aka cypress.json

{
  "firefoxGcInterval": {
    "runMode": null,
    "openMode": null
  }
}

Edited by @jennifer-shehane - removed "firefoxGcInterval": null workaround.

@EtienneBruines
Copy link
Author

Regarding the workaround:

"firefoxGcInterval": null gave me:

TypeError: intervals is null
 Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'Test reset password'
   createIntervalGetter/<@http://localhost/__cypress/runner/cypress_runner.js:145972:22
   install/<@http://localhost/__cypress/runner/cypress_runner.js:145995:30
   listener@http://localhost/__cypress/runner/cypress_runner.js:138840:19
   tryCatcher@http://localhost/__cypress/runner/cypress_runner.js:165465:23
   ./node_modules/bluebird/js/release/map.js/module.exports/MappingPromiseArray.prototype._promiseFulfilled@http://localhost/__cypress/runner/cypress_runner.js:162586:38
   ./node_modules/bluebird/js/release/promise_array.js/module.exports/PromiseArray.prototype._iterate@http://localhost/__cypress/runner/cypress_runner.js:163787:31
   init@http://localhost/__cypress/runner/cypress_runner.js:163751:10
   ./node_modules/bluebird/js/release/map.js/module.exports/MappingPromiseArray.prototype._asyncInit@http://localhost/__cypress/runner/cypress_runner.js:162555:10
   ./node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueue@http://localhost/__cypress/runner/cypress_runner.js:160195:12
   ./node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueues@http://localhost/__cypress/runner/cypress_runner.js:160200:10
   Async/this.drainQueues@http://localhost/__cypress/runner/cypress_runner.js:160074:14

This one does seem to have the desired effect, not throwing any other errors:

{
  "firefoxGcInterval": {
    "runMode": null,
    "openMode": null
  }
}

@jennifer-shehane
Copy link
Member

oh, you're right. This is what I get for not running all the code I pasted 😅 Will update my comment and see if this is a separate issue.

@jennifer-shehane
Copy link
Member

Opened an issue here for firefoxGcInterval: null not being supported #6825

kevinold pushed a commit to cypress-io/cypress-realworld-app that referenced this issue Jun 16, 2020
kevinold pushed a commit to cypress-io/cypress-realworld-app that referenced this issue Jun 16, 2020
…l flake (#428)

* update docker image

* update node version to 12.18

* wait for comment to be posted

* set firefoxGcInterval to null per cypress-io/cypress#6813

* remove quotes from cypress config

* add assertion to fix additional flake

* set firefoxGcInterval to null in cypress.json vs circle config

* ensure like button click is registered on server
@dvngnt
Copy link

dvngnt commented Jun 18, 2020

Trying the workaround posted seems to allow me to complete one test but then fails immediately after

Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:201:27)
 {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}
Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:201:27)`

Cypress: 4.8.0 │
│ Browser: Firefox 77 (headless)`

@jpita
Copy link

jpita commented Jun 19, 2020

Trying the workaround posted seems to allow me to complete one test but then fails immediately after

Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:201:27) { errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' } Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:201:27)

Cypress: 4.8.0 │ │ Browser: Firefox 77 (headless)

How do you set Firefox to headless?
Do the tests run without the headless ?

@EtienneBruines
Copy link
Author

@jpita pass --headless to the command line to run as headless

According to #6813 (comment) it does not run headed (not-headless) either.

@jpita
Copy link

jpita commented Jun 21, 2020

@jpita pass --headless to the command line to run as headless

According to #6813 (comment) it does not run headed (not-headless) either.

both work fine for me on 4.8.0

@Seb-C
Copy link

Seb-C commented Jun 24, 2020

The same error started to happen in GitHub actions 2~3 weeks ago. Before it was running fine. I do not know what changed (same Firefox version, same Cypress version and same commit in my codebase suddenly stopped working).

--headless is not an option for me because I use Cypress to test an extension.

Fortunately "runMode": null fixed my problem for now.

j-berman added a commit to smallbets/userbase that referenced this issue Jul 2, 2020
@jbrokamp
Copy link

jbrokamp commented Jul 5, 2020

The error persists in Cypress version 4.9.0 in combination with docker image cypress/browsers:node12.14.1-chrome83-ff77

emilyemorehouse added a commit to cuttlesoft/react-boilerplate.com that referenced this issue Jul 5, 2020
…oxGcInterval` settings for `runMode` and `openMode` to null

- See cypress-io/cypress#6813 for open issue
emilyemorehouse added a commit to cuttlesoft/react-boilerplate.com that referenced this issue Jul 5, 2020
…oxGcInterval` settings for `runMode` and `openMode` to null

- See cypress-io/cypress#6813 for open issue
emilyemorehouse added a commit to cuttlesoft/react-boilerplate.com that referenced this issue Jul 5, 2020
…oxGcInterval` settings for `runMode` and `openMode` to null

- See cypress-io/cypress#6813 for open issue
@jennifer-shehane
Copy link
Member

The code for this is done in cypress-io/cypress#7791, but has yet to be released.

We'll update this issue and reference the changelog when it's released.

@jennifer-shehane
Copy link
Member

The work for this has been moved to #8040 in order to get our pre-5.0 release.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 21, 2020

Released in 4.11.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.11.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jul 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants