testcafe: TestCafe hangs on loading page and freezes execution when executing concurrently

What is your Scenario?

Concurrently run 5 fixtures that execute a single test. Visiting https://uk.zwift.com results in TC hanging indefinitely and preventing the remainder of test execution.

What is the Current behavior?

TestCafe hangs on page load

What is the Expected behavior?

Pages are loaded concurrently as expected

What is your public website URL? (or attach your complete example)

https://github.com/vlads11/TC-PageLoadError

  1. npm install
  2. testcafe chrome ./Tests/* -c 5 --skip-js-errors

This may need to be triggered a few times but it consistently reproduces

What is your TestCafe test code?

Test Code provided https://github.com/vlads11/TC-PageLoadError ----- this single fixture is duplicated 5 times to reproduce the error in question.

import { Selector } from “testcafe”; import { test } from ‘testcafe’;

let homeURL = ‘https://uk.zwift.com’;

//slice0 let slice0 = Selector(‘[class='image-with-text-overlay__banner columns one-whole image-crop-none']’)

fixture Shopify HowZwiftWorkspage .page(‘about:blank’) .beforeEach(async t => { await t.navigateTo(homeURL); })

test(‘Slice0 Get Started Button goes to Create Account page’, async t => { await t.click(slice0); })

Your complete configuration file

default

Your complete test report

No response

Screenshots

Recording of issue can be seen here: https://github.com/vlads11/TC-PageLoadError/blob/main/ScreenRecording.mov

Steps to Reproduce

  1. Navigate to https://uk.zwift.com with a concurrent session count of 3 or higher
  2. Notice page hang and never completes loading.

TestCafe version

1.18.6

Node.js version

v16.14.2

Command-line arguments

testcafe chrome ./Tests/* -c 5 --skip-js-errors

Browser name(s) and version(s)

Chrome 101

Platform(s) and version(s)

macOS 12.3.1 but also happens in Linux

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 30 (2 by maintainers)

Most upvoted comments

To provide an update: We tried a number of things and finally had some progress by running tests via testcafe runner in groups. We had the same situation as @alienintheheights mentioned - 200+ tests and it was hanging in random places without any logs. We split the tests in two almost equal size groups and they still hang from time to time but not so often - say 1-2 in 20, while before it was 9 hangs from 10 runs. It’s not ideal but at least it doesn’t fully block our work. We are yet to experiment splitting the tests in more groups. Hope this helps.

Also running into this. Our tests consistently hang, though the point at which they do varies (we have around 300 tests that run nightly). No concurrency. Running latest, 2.6.1, on node 16.13.2.

When it gets stuck, strace on the /node_modules/.bin/testcafe process shows this over and over:

 strace -f -tt -s 200 -p 6490
strace: Process 6490 attached with 7 threads
[pid  6496] 14:20:07.310527 futex(0x65b99ec, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
[pid  6495] 14:20:07.310672 futex(0x64c089c, FUTEX_WAIT_PRIVATE, 4, NULL <unfinished ...>
[pid  6494] 14:20:07.310705 futex(0x64c089c, FUTEX_WAIT_PRIVATE, 4, NULL <unfinished ...>
[pid  6493] 14:20:07.310734 futex(0x64c089c, FUTEX_WAIT_PRIVATE, 4, NULL <unfinished ...>
[pid  6492] 14:20:07.310762 futex(0x64c089c, FUTEX_WAIT_PRIVATE, 4, NULL <unfinished ...>
[pid  6491] 14:20:07.310789 epoll_wait(9,  <unfinished ...>
[pid  6490] 14:20:07.358401 epoll_wait(13,

Those pids correspond to defunct instances of Google chrome. New ones have been spawned in its place.

www   6542     1  0 13:09 ?        00:00:00 /opt/google/chrome/chrome_crashpad_handler --monitor-self-annotation=ptype=crashpad-handle
www   6547  6535  0 13:09 pts/0    00:00:00 /opt/google/chrome/chrome --type=zygote --no-zygote-sandbox --headless --headless --crashp
www  6549  6535  0 13:09 pts/0    00:00:00 /opt/google/chrome/chrome --type=zygote --headless --headless --crashpad-handler-pid=6542
www   6552  6549  0 13:09 pts/0    00:00:00 /opt/google/chrome/chrome --type=zygote --headless --headless --crashpad-handler-pid=6542
www   6570  6535  2 13:09 pts/0    00:02:09 /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService -
www   6573  6552 49 13:09 pts/0    00:37:17 /opt/google/chrome/chrome --type=renderer --headless --crashpad-handler-pid=6542 --first-r
www   6606  6547  2 13:09 pts/0    00:01:30 /opt/google/chrome/chrome --type=gpu-process --headless --ozone-platform=headless --use-an
www   6607  6606  0 13:09 pts/0    00:00:00 /opt/google/chrome/chrome --type=broker

Meanwhile the node_modules/testcafe/lib/cli process is looping the following POST to /messaging

[pid  6497] 14:21:33.576119 epoll_wait(14, [], 1024, 0) = 0
[pid  6497] 14:21:33.576213 epoll_wait(14, [], 1024, 425) = 0
[pid  6497] 14:21:34.001847 epoll_wait(14, [], 1024, 0) = 0
[pid  6497] 14:21:34.001935 epoll_wait(14, [{EPOLLIN, {u32=27, u64=27}}], 1024, 1976) = 1
[pid  6497] 14:21:34.084023 read(27, "POST /messaging HTTP/1.1\r\nHost: 192.168.2.100:41539\r\nConnection: keep-alive\r\nContent-Length: 230\r\ncache-control: no-cache, no-store, must-revalidate\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleW"..., 65536) = 688
[pid  6497] 14:21:34.085589 writev(27, [{iov_base="HTTP/1.1 200 OK\r\ncontent-type: application/json\r\ncache-control: no-cache, no-store, must-revalidate\r\npragma: no-cache\r\nDate: Thu, 01 Jun 2023 19:21:34 GMT\r\nConnection: keep-alive\r\nKeep-Alive: timeout="..., iov_len=1511}, {iov_base="", iov_len=0}], 2) = 1511

Don’t know if that helps. We had the same outcome on older versions too.

This is our .testcaferc.json

{
   
    "browsers": ["chrome:headless"],
    "src": ["test/*-test.js"],

    "speed": 1,
    "selectorTimeout": 30000,
    "assertionTimeout": 30000,
    "pageLoadTimeout": 60000,
    "ajaxRequestTimeout": 300000,
    "testExecutionTimeout": 300000,
    "nativeAutomation": false,

    "quarantineMode": false,
    "debugMode": false,
    "debugOnFail": false,
    "stopOnFirstFail": false,
    "skipJsErrors": true,
    "skipUncaughtErrors": true,
    "disablePageCaching": true,
    "developmentMode": false,
    
    "reporter": [
        {
            "name": "spec"
        },
        {
            "name": "xunit",
            "output": "test/output/reports/report.xml"
        },
        {
            "name": "html",
            "output": "test/output/reports/report.html" 
        }
    ],

    "screenshots": {
        "path": "test/output/screenshots",
        "takeOnFails": true,
        "pathPattern": "${DATE}_${TIME}/${FIXTURE}/test-${TEST_INDEX}/${FILE_INDEX}.png"
    }

   
}

Hi - we are seeing similar problem on firefox and without concurrency, too.