cypress: Occasional TCP.get errors causing failing specs since updating to Cypress 10

Current behavior

I’m very confused by a Cypress/lodash error I’ve been encountering since updating to Cypress 10. The end result is that the test fails and the job times out on the Cypress Dashboard.

No screenshots or recording because the spec never completed. Here’s the Cypress Dashboard error message:

Screenshot 2022-06-17 at 15 56 28

And the lack of video/screenshots: Screenshot 2022-06-17 at 15 57 59

We’re running our tests via Jenkins, with orchestration courtesy of the Cypress Dashboard. Here’s the output for one of the affected jobs:

12:20:37  Cannot read properties of null (reading 'reading')
12:20:37  TypeError: Cannot read properties of null (reading 'reading')
12:20:37      at TCP.get [as reading] (node:_tls_wrap:634:27)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2730:27
12:20:37      at arrayEach (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:530:11)
12:20:37      at baseClone (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2727:7)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2733:34
12:20:37      at arrayEach (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:530:11)
12:20:37      at baseClone (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2727:7)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2733:34
12:20:37      at arrayEach (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:530:11)
12:20:37      at baseClone (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2727:7)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2733:34
12:20:37      at arrayEach (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:530:11)
12:20:37      at baseClone (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2727:7)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2733:34
12:20:37      at arrayEach (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:530:11)
12:20:37      at baseClone (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:2727:7)
12:20:37      at Function.cloneDeep (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/lodash/lodash.js:11156:14)
12:20:37      at HttpBuffers.set (/app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/proxy/lib/http/util/buffers.js:26:32)
12:20:37      at Http.setBuffer (/app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/proxy/lib/http/index.js:221:29)
12:20:37      at NetworkProxy.setHttpBuffer (/app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/proxy/lib/network-proxy.js:19:19)
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/server/lib/server-e2e.js:248:103
12:20:37      at /app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/network/lib/concat-stream.js:22:16
12:20:37      at ConcatStream.<anonymous> (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/concat-stream/index.js:37:43)
12:20:37      at ConcatStream.emit (node:events:402:35)
12:20:37      at ConcatStream.emit (node:domain:475:12)
12:20:37      at finishMaybe (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/readable-stream/lib/_stream_writable.js:630:14)
12:20:37      at endWritable (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/readable-stream/lib/_stream_writable.js:638:3)
12:20:37      at ConcatStream.Writable.end (/app/.cache/Cypress/10.0.2/Cypress/resources/app/node_modules/readable-stream/lib/_stream_writable.js:594:41)
12:20:37      at Duplexify.onend (/app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/server/node_modules/readable-stream/lib/_stream_readable.js:646:10)
12:20:37      at Object.onceWrapper (node:events:509:28)
12:20:37      at Duplexify.emit (node:events:390:28)
12:20:37      at Duplexify.emit (node:domain:475:12)
12:20:37      at endReadableNT (/app/.cache/Cypress/10.0.2/Cypress/resources/app/packages/server/node_modules/readable-stream/lib/_stream_readable.js:1094:12)
12:20:37      at processTicksAndRejections (node:internal/process/task_queues:83:21)
12:20:37      at runNextTicks (node:internal/process/task_queues:65:3)
12:20:37      at processImmediate (node:internal/timers:437:9)

I don’t use lodash at all in my Cypress tests. And given that this started after updating to Cypress 10, I don’t believe the issue is due to the specs themselves.

In the stack trace above, I see mentions of Duplexify. We definitely aren’t using that in our tests, so I suspect that this is something to do with refactored video/screenshot upload logic in the newest Cypress

Just a hunch, but I noticed that this file changed recently. It’s mentioned in the stack trace and it also uses lodash. Could it be something to do with that?

Desired behavior

Desired outcome would be to no longer have this issue affecting our Jenkins runs and timing out on the Cypress Dashboard

Test code to reproduce

It’ll be difficult for me to provide a reproducible example, as the issue seems dependent on Cypress’ TCP.get not receiving a response from Cypress Dashboard.

I’d be happy to turn on debugging for one of our Jenkins jobs so that you have some more information, though. Just let me know what to add to give you the info you need, and I’ll email it to Cypress.

Cypress Version

10.1.0

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 21
  • Comments: 40 (19 by maintainers)

Most upvoted comments

Ok, folks!

I deployed the 10.4.0 on our side yesterday in the morning (9 AM UTC). We had 15 green runs and 0 red since.

I will keep an eye on the logs for another day or two, but it’s very promising!

I’ll keep you posted!

Any progress? @AtofStryker

I am back on rotation this week and next and am hoping to take a look into this!

@liambutler what version of Cypress were you on before 10.x? I am curious if you used 9.7 before upgrading and noticed this issue, since we upgraded Electron then and might be a good signal for what the issue is/isn’t.

Just to add a data point to your investigation - I’ve just run into the exact same error. Still on 9.7, running cypress in the official docker image cypress/included:9.7.0.

Hi @AtofStryker, I am sorry for creating this confusion.

The issue was that I missed that we were installing Cypress via npm on the image, so the native 10.7.0 got replaced by 9.7.0.

Great news to hear from those where the problem seems to resolve with the electron upgrade. We decided to close the issue as we believe it is resolved, but if it is still an issue for anyone please let us know!

The same 😃 It has been fixed

We currently are on the 10.3.1 and the issue is still happening.

I plan to upgrade our Cypress to 10.4.0 very soon (early next week 🙏). I originally planned to do it today, but… heh… you know… day-to-day emergencies ¯_(ツ)_/¯

Once done, I will keep you posted (we use to have 5 to 10 runs a day, if the issue persists, it should be spotted quickly)

@AtofStryker Haven’t had the issue since the upgrade but we’ve only had 4 runs since (so the upstream of the test repo has been upgraded to 10.4).

So far I have forked @verheyenkoen 's project and have run yarn test inside the project directory about 15 times. I haven’t run into the issue yet, but I am also on node version 16.15.0. I’m going to downgrade to 16.14.2 and try to continue to reproduce the issue.

In the meantime, would anyone be able to upgrade to Cypress 10.4.0 and try this out? #22291 was related to a known issue that was patched in Node 16.14.2, and am wondering if the subprocess Electron is using is the packaged node version (see https://github.com/cypress-io/cypress/issues/22291#issuecomment-1154782275), (which I believe is 16.13.2 from #22775). However, I haven’t been able to find an issue in node that would suggest this is an issue, but want to possibly rule this hunch out.

That being said, a reproduction would be incredibly useful here so we could test it with the upgrade to confirm our suspicions.

@AtofStryker If you’ve got a build that I can access, I can run it on my Jenkins Job to give you some confidence

We are going to work to get something together hopefully within the next few weeks that works on Electron v19 that may confirm that it fixes the issue. It does seem weird that the issue does happen intermittently, almost like a CI box has some stale dependencies. @emilyrohrbough has a bit of a hunch that openSSL (I guess in this case boringSSL) might be out of date, which is causing the buffer clone to fail when doing a cy.visit since the stream might have terminated early, which is also a plausible explanation for this type of behavior. Hopefully we can start ruling some things out once we are a bit closer to having an upgrade available.

I see the same with: 9.7.0