question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught exception: socket has been ended by the other party

See original GitHub issue

Hello!

I implemented a runner for the project I’m working on using the TestCafe API. With my coworkers, we noticed that some tests started failing after we upgraded NodeJS past version 10.15.3 (basically, no problem with 10.15.3 or below, but anything newer and we get the issue described here)

We randomly receive the following error:

× Scenario: Successful registration process (single step)
   1) Uncaught exception:
      Error: This socket has been ended by the other party
      at TLSSocket.writeAfterFIN [as write] (net.js:407:14)
      at Socket.ondata (_stream_readable.js:713:22)
      at Socket.emit (events.js:200:13)
      at Socket.EventEmitter.emit (domain.js:471:20)
      at addChunk (_stream_readable.js:294:12)
      at readableAddChunk (_stream_readable.js:275:11)
      at Socket.Readable.push (_stream_readable.js:210:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:166:17)
      Browser: Chrome 84.0.4147.125 / Windows 10

Otherwise, the test itself does not have any reason to fail (one test will be fine for several runs, then fail with that error - and only that error)

I manage to trigger it by chaining a lot of navigateTo to our website. => I usually get a few fails out of 10 identical tests (see the test code)

My investigation so far shows that it seems to be linked to our usage of WebSocket. The issue only happens with Chrome, but we want coverage of all browsers (plus Firefox seems to not always close properly but that’s an issue for another time) Downgrading NodeJS solves the issue but the rest of the project now relies on a newer version, meaning we have to switch back and forth, which is not ideal.

I’m not sure you will have access to the website in the example - it is protected against access out of belgium. I might be able to arrange something if needed. I’ve reproduced the issue with another website (a completely different front-end, that we started from scratch so it does not have much in common with the current site) I was NOT able to reproduce the issue with external websites that use WebSocket (again, we might have a heavier load on the WS than the websites I tried)

Your website URL (or attach your complete example): https://www.circus.be
Your complete test code (or attach your test files):
fixture`Test the runner`;

test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});
test('Basic V3 test', async (t) => {
  await t.navigateTo('https://www.circus.be').wait(5000);
});

Your Environment details:

  • testcafe version: 1.9.1
  • node.js version: 12.18.3
  • browser name and version: Chrome 84
  • platform and version: Windows 10

report.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Farfurixcommented, Dec 22, 2020

@Arthy000

Hello,

No updates yet. We plan to research this issue, but I cannot give you any time frames as to when the issue will be resolved.

0reactions
Farfurixcommented, Mar 1, 2021

@Arthy000

Hello,

I checked it again and wasn’t able to reproduce the WebSoket (without TestCafe), and the following test passed without errors:

fixture`Test the runner`;

test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});
test('Basic V3 test', async (t) => {
    await t.navigateTo('https://www.circus.es').wait(5000);
});

Result: Capture

My setup: Windows 10, Node.js v14.15.4, TestCafe v1.11.0, Chrome 88.

I believe that the “This socket has been ended by the other party” error relates to the WebSoket error I faced before without TestCafe and thus this error should be fixed on the website side. I’ll close the issue.

@janrozycki

Hello,

If your scenario doesn’t relate to the @Arthy000 tested website, I recommend you create a new issue with a simple reproducible example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What causes Error: This socket has been ended by the other ...
Typically this is sent when another application (client, browser, etc.) closes the socket when you are still sending data to it from the...
Read more >
Nodejs Error: This socket has been ended by the other party
My understanding of sockets is that they represent endpoints in a stream between the client and the server. When that stream is no...
Read more >
This socket has been ended by the other party - SideQuest
Was going to try to download Revomon to give it a show but I keep getting this error: This socket has been ended...
Read more >
Help plz : r/sidequest - Reddit
A JavaScript error occurred in the main process. Uncaught Exception: Error: This socket has been ended by the other party. at Socket.
Read more >
[Urgent] n8n docker, self-hosted instance restarting every 3-8 ...
Describe the issue/error/question For the past hour, my n8n instance is stuck in a ... Error: This socket has been ended by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found