Recover from renderer / browser crashes
See original GitHub issueRelated to #348.
It is actually possible for Cypress to implement strategies when the renderer (or browser process) crashes during a test run - something like recoverFromRendererCrashes: true
by default.
There is already a mechanism for Cypress to “reload” mid-run, rebuild the state of every previous run test, skip over previously run tests, and continue with the next one in line.
In fact this is exactly what cy.visit
already does under the hood.
We can utilize this same process upon a renderer / browser process crashing to continue on with the run.
So it may look something like this:
(Running Tests)
✓ test 1 - foo
✓ test 2 - bar
✓ test 3 - baz
Oh noes the renderer process crashed... we will attempt to recover
...Restarting tests at 'test 4 - quux'
✓ test 4 - quux
✓ test 5 - ipsum
Taking this a step further, we are starting to see several patterns emerge with how and why renderer processes crash - it is almost always related to extremely long test runs in a memory starved environment (such as Docker).
It may even be a good idea for us to always preemptively “break up” headless runs by spec file.
In other words, we could have an option like restartBrowserBetweenSpecFiles: true
which would automatically kill the renderer / browser process before moving on to a different spec file (but still rebuild the state of the UI correctly, and still have a single contiguous video recording).
To the user it would look like nothing is really different, but internally the renderer process would be killed and then restarted.
This would forcefully purge primed memory from the process, which could keep environments like docker
from ever crashing to begin with.
Depends on: #6170
Issue Analytics
- State:
- Created 7 years ago
- Reactions:103
- Comments:84 (10 by maintainers)
Top GitHub Comments
We’ve started hitting this fairly frequently now too
We are hitting this problem as well. Not using Docker. Unfortunately, this issue makes cypress way too unreliable for automated tests.