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

Tests sometimes (frequently) lose connection #1647

Closed
ryuuji3 opened this issue Jun 13, 2018 · 21 comments
Closed

Tests sometimes (frequently) lose connection #1647

ryuuji3 opened this issue Jun 13, 2018 · 21 comments
Assignees
Labels
STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@ryuuji3
Copy link

ryuuji3 commented Jun 13, 2018

Sometimes when I launch tests, the tests suddenly stops; I get this error message when I look at the console.

It doesn't matter what browser I use. I am on MacOS

.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20
        throw new Error(err);
        ^

Error: Error: write EPIPE
    at Domain.<anonymous> (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
    at Domain.emit (events.js:182:13)
    at Domain.EventEmitter.emit (domain.js:442:20)
    at Domain._errorHandler (domain.js:224:23)
    at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
    at process._fatalException (internal/bootstrap/node.js:447:31)```
@miherlosev
Copy link
Contributor

Hi @ryuuji3

It's difficult to understand the reason of problem by provided your information.
Please provide more details for us:

  • MacOS version
  • nodejs version
  • a test (or test suite) on which the problem is reproduced

@ryuuji3
Copy link
Author

ryuuji3 commented Jun 16, 2018

Sorry for the late reply,
MacOS: High Sierra 10.13.1 (17B1003)
Chrome: 67.0.3396.79 (Official Build) (64-bit)
NodeJS: v10.4.1
Sample test:

Command: testcafe chrome tests/

fixture`Login and Registration`.page(`example.com`)

test('Sign up', async t => {
  await t
  .click(home.registerButton)
  .typeText(register.firstName, 'firstname')
  .typeText(register.lastName, 'lastName')
  .typeText(register.email1, 'email')
  .typeText(register.email2, 'email')
  .typeText(register.password1, 'password')
  .typeText(register.password2, 'password')
  .click(register.signupButton)
  .wait(5000)
})

At any time during the test, I might suddenly lose connection and the test stops. This happened on Safari and Chrome. I would see the typing pause, and then when I look at my open terminal, I would see the error message. Restarting the test may or may not solve the problem, until it happens again.

@cmmv91
Copy link

cmmv91 commented Jun 25, 2018

I'm having the exact same issue:

Mac OS X 10.13.5
Chrome: 67.0.3396.87 (Official Build) (64-bit)
Node: v10.1.0

issue:
Error: Error: write EPIPE
at Domain. (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
at Domain.emit (events.js:182:13)
at Domain.EventEmitter.emit (domain.js:442:20)
at Domain._errorHandler (domain.js:224:23)
at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
at process._fatalException (internal/bootstrap/node.js:435:31)

@SleepyWerewolf
Copy link

SleepyWerewolf commented Jun 26, 2018

Same.

Mac OS X 10.13.4
Chrome 67.0.3396.99 (Official Build) (64-bit)
Node v10.3.0

Error: Error: write EPIPE
    at Domain.<anonymous> (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
    at Domain.emit (events.js:182:13)
    at Domain.EventEmitter.emit (domain.js:442:20)
    at Domain._errorHandler (domain.js:224:23)
    at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
    at process._fatalException (internal/bootstrap/node.js:447:31)
error Command failed with exit code 7.

@LavrovArtem
Copy link
Contributor

Hi guys,

I tried running a simple test with authentication on GitHub 20 times and I cannot reproduce this error. Could you please create a simple example and test so that I could reproduce the issue. Or you can mail me the URL of the page I could use to reproduce this error (find my email in GitHub account settings).

Mac OS X 10.13.3
Chrome 67.0.3396.99 (Official Build) (64-bit)
Node v10.5.0

@cmmv91
Copy link

cmmv91 commented Jun 26, 2018

The error is not 100% reproducible, it happens randomly but frequently, I would say for me happens around 40% of the times, when the page is under heavy load appears to have a frequency increase. However I haven't been able to reproduce it on safari nor firefox yet.

@sirgallifrey
Copy link

I'm experiencing this as well, was working fine with testcafe v0.18, it started when I upgraded to testcafe v0.20.4

If I run it inside my docker env it runs fine. On my host I get this error 100% of the time.

On my docker I have node v8.7.0 and yarn v1.2.0. On my host node v10.4.1 and yarn v1.7.0

@miherlosev
Copy link
Contributor

Guys, it all indicates that the problem exists.
To find the cause of this issue and fix it, we need a simple example.
So, we are looking forward to receiving a project where this problem is reproducible.
 

@ryuuji3
Copy link
Author

ryuuji3 commented Jul 3, 2018

I'm going to quickly write a example project right now, but if anyone beats me to the punch, I won't be mad.

Edit: I have a test for work that already is written, but I prefer not to post it. I can send you the project in a DM? @miherlosev

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

I have a class like this:

class SignupTest {
  constructor(private t: TestController) { }

  register() {
    await this.t // everything in the function uses the instance of t
  }

And in my actual test:

test('Register, async t => {
  const model = new SignupTest(t)
  model.register(profile)
  model.login(profile.username, profile.password)
})

Does this look something similar to the tests you guys wrote, as well?

@sirgallifrey
Copy link

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

I'm not doing this, but I use the Role api everywhere and it always crashes on the first time a t.useRole is called... I don't know how it works internally but the TestController seems to be passed around... It might store a reference under the hoods?

@miherlosev
Copy link
Contributor

Edit: I have a test for work that already is written, but I prefer not to post it. I can send you the project in a DM? @miherlosev

Could you please send me your project to [email protected]?

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

Your code looks good. Also, your can import TestController directly from TestCafe and use it in your page object classes.
Example:

import { t } from 'testcafe';

class SignupTest {
  register() {
    ...
    await t.click('#submit');
  }

@vladimirdrndarski
Copy link

We just ran into this issue and found the solution. It turned out to be a mis-match between the node version and the testcafe version. We ended up downgrading node (to 9.2.1) to match with our older version of testcafe (0.19.2).

@miherlosev
Copy link
Contributor

@vladimirdrndarski @sirgallifrey @cmmv91 @SleepyWerewolf @ryuuji3

Guys, according to you descriptions, I can assume that the problem is related to the built-in modules (http and https) of Nodejs.
I am afraid only a small and reproducible example can help us to understand and fix this problem.

LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Aug 17, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Aug 17, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Aug 17, 2018
@LavrovArtem LavrovArtem self-assigned this Aug 17, 2018
@LavrovArtem LavrovArtem added this to the Sprint #16 milestone Aug 17, 2018
@LavrovArtem
Copy link
Contributor

We need to fix it behavior for Linux too.

@LavrovArtem LavrovArtem reopened this Sep 20, 2018
@LavrovArtem LavrovArtem modified the milestones: Sprint #16, Sprint #18 Sep 20, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Sep 26, 2018
@NickCis
Copy link
Contributor

NickCis commented Oct 5, 2018

@LavrovArtem In what release will land your fix?

@LavrovArtem
Copy link
Contributor

@NickCis The fix is published in 0.22.1-alpha.3.

@DerMika
Copy link

DerMika commented Oct 24, 2018

Hi, We probably have the same issue, but we're using the testcafe/testcafe docker image from Dockerhub to run our builds in Bitbucket pipelines.

If I use the :alpha tag, i'm getting 0.22.1-alpha.1. Is there a reason why you're not pushing proper versions to dockerhub besides "latest", "alpha" and "dev"? Or why you're not consistently pushing all alpha builds to docker?

@miherlosev
Copy link
Contributor

miherlosev commented Oct 24, 2018

Hi @DerMika

Is there a reason why you're not pushing proper versions to dockerhub besides "latest", "alpha" and "dev"?

At present, we do not publish dev versions anymore. So, the image with the dev tag is not actual. I will remove it later.

Or why you're not consistently pushing all alpha builds to docker?

This is a bug. I will research it and let you know my results.

@DerMika
Copy link

DerMika commented Oct 24, 2018

This is a bug. I will research it and let you know my results.

Thanks for that!

I was also wondering why you aren't pushing version tags for specific releases of Testcafé. That would make it easier for us at least to tag a specific version and get reliable results. Right now I'm running 0.20.0 although I am using "latest". This is because I never deleted my local image of when docker first downloaded the "latest" tag, docker will never fetch a newer version because it thinks it still has the correct version locally.

@miherlosev
Copy link
Contributor

We have an enhancement for that in the TestCafe repository. Track this issue to be aware of our progress.

AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…1647, related to DevExpress/testcafe#2711) (DevExpress#1729)

* fix `Tests sometimes (frequently) lose connection` (close DevExpress#1647, related to DevExpress/testcafe#2711)

* add comment
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…evExpress#1647) (DevExpress#1768)

* fix `Tests sometimes (frequently) lose connection` (for Linux) (close DevExpress#1647)

* fix remark

* fix remark
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

9 participants