my suite runs about 1200 cypress tests for about 2 hours. Most of the time it hangs indefinitely at some point. Then I am seeing the logs below, where it seems to get stuck in some infinite loop.
logs with "DEBUG=cypress:*" set:
https://gist.github.com/cameronc56/b94c64533526751c0950a9d66c8f73c0
Is the indefinite hanging point in the same spot each time? Could you share the sequence of tests you're running for each visit/request in these 1200 tests?
It is not the same spot each time.
This is whats happening 1200+ times:
cases.forEach(testCase => {
it('visits ' + testCase.href + testCase.path + ' and verifies matched inputs', () => {
cy.visit(testCase.href + testCase.path);
testCase.assert_rules.forEach(rule => {
cy.get("[data-swch-rule*='" + rule + "']", {timeout: 5000});
});
testCase.assert_fieldTypes.forEach(fieldType => {
cy.get("[data-swch-fieldtype*='" + fieldType + "']", {timeout: 5000});
});
});
});
where the testCase.href+testCase.path leads to a static site hosted in s3 with various inputs and elements. No css, no javascript. Though some images are there. The chrome extension I am testing modifies the dom slightly, and the assertions verify that was done correctly.
My numtestskeptinmemory is set to 5, viewport is set to 1920x1080,
Heres the logs from another repro. You can see that the hanging started on a different test case than before. The first log i posted it started on some greenmountain snapshot, this time it was bhpphoto.
https://gist.github.com/cameronc56/1d743481349a688a390489c25f09c9cf
So, in an attempt to narrow down the variables, I ran 2,000 tests executing a cy.visit() with multiple cy.get() commands in each test. These ran fine and finished locally in cypress run.

I did actually run into the cypress:server:timers locking up after the tests finished (looks like may be during video processing) - this seems unrelated to your issue, but do you have videoRecording set to false? You may want to try it off.

Is there any way to expand on my simplified example to get them failing? We need a reproducible example to get to the root of the issue.
const cases = [...Array(1200)]
const assert_rules = [...Array(10)]
const assert_fieldTypes = [...Array(10)]
cases.forEach(i => {
it('visits and verifies matched els', () => {
cy.visit('https://example.cypress.io//commands/querying')
assert_rules.forEach(j => {
cy.get('.query-btn', { timeout: 5000 })
});
assert_fieldTypes.forEach(k => {
cy.get('.query-list', { timeout: 5000 })
})
})
})
Trying a run with videoRecording set to false now
Was still able to repro
So i tried running your example in my docker environment, and it looks(?) like I was able to repro it.
I'll try running it again without the plugins file, (which is loading an extension). If thats not it I'll start removing stuff bit by bit from my dockerfile
Ok, I am able to get a repro without my extension. I have made the snapshot I repro'd it on public so you can access it. Repro was on test 283 out of 1000. Second repro hung on test 567/1000. Yes I am aware the tests will all fail, this is expected since the extension is not there.
I have the cy.reload(true) in there to force reload, to simulate that I am navigating to a bunch of different snapshots in my real tests.
Here is the code I used:
let cases = []
for (let i = 1; i <= 1000; i++) {
cases.push(i);
}
const assert_rules = ["login"]
const assert_fieldTypes = ["accounts.password", "accounts.username", "submit"]
cases.forEach(i => {
it('visits and verifies matched element: ' + i, () => {
cy.visit('https://s3-us-west-2.amazonaws.com/public-test-swch/myaccount_greenmountain_com-1514499557386.html');
cy.reload(true);
assert_rules.forEach(rule => {
cy.get("[data-swch-rule*='" + rule + "']", {timeout: 5000});
});
assert_fieldTypes.forEach(fieldType => {
cy.get("[data-swch-fieldtype*='" + fieldType + "']", {timeout: 5000});
});
});
});
Dockerfile:
FROM cypress/base:8
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y dbus-x11 google-chrome-stable apt-transport-https && \
rm -rf /var/lib/apt/lists/*
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
ENV npm_config_unsafe_perm true
WORKDIR /code
ADD . /code
RUN npm install --quiet
CMD /bin/bash
Then I ran it by doing:
docker run -it -e "DEBUG=cypress:*" -v /dev/shm:/dev/shm --ipc=host --security-opt seccomp:unconfined --rm switch/my-image:latest /bin/bash
./node_modules/.bin/cypress run --browser chrome
I'll try and throw these files in a public repo so you can just clone it, build and run
I've removed a bunch of files/code from that repository and still am able to repro it, narrowing the search down a little more
This is good - keep going.
Does it hang outside of Docker? Does it hang in electron too and not just chrome?
So I ran it outside of docker, using chrome, and it hanged. This is a screenshot of what chrome looked like when it was hanging:

Interesting. Gonna try and repro with electron now..
Could't repro with electron, gonna try a couple more times just to be sure.
that narrows it down to just three parameters then: The spec file, the site snapshot, and chrome.
We are seeing this behavior in Docker w/ the default browser — which is Electron for cypress run, correct? I have never been able to repro in "headed mode".
I tried a few more times and wasn't able to reproduce it with electron.
I have re-snapshotted my tests and removed all script tags (some were lingering) and haven't been able to repro the hanging issue.
So i'm pretty sure its CSS or Javascript on that snapshot site (https://s3-us-west-2.amazonaws.com/public-test-swch/myaccount_greenmountain_com-1514499557386.html) that is causing it to hang when using chrome.
I am still running into this issue in 2019, never the same test, always during long runs.
Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?
Most helpful comment
I am still running into this issue in 2019, never the same test, always during long runs.