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.

Detect and Recover when Browser Hangs/Crashes/Dies

See original GitHub issue

Current behavior

Cypress does not handle browser tab crashes, hanging browsers or issues related to browsers unexpectedly dying. This cause Cypress to hang indefinitely until the process is manually stopped or CI times out.

Desired behavior

Cypress should handle tab crashes and timeout on browsers hangs.

  • Tab Crash - Cypress should handle closing the tab, reopening a new tab and continue the test execution.

  • Browser hangs - The Cypress runner should timeout the test, send the status to the server to end the test, report the failure to the dashboard (if recording enabled) before killing the current browser instance and launching a new instance to continue test execution.

The quick-(er) fix will be to fail the current test and pickup the next test to provide reporting on the tests that were able to run. The ideal solution would be re-attempting the test that experienced the crash to reduce test flake & CI costs for users and/or to help identify memory issues within the code under test.

Considerations to Keep in Mind

When the browser tab and/or instance is killed and re-launched, ensure we are release the node resources initially used to ensure JS memory does not grow with each launch.

It would be great if there was a way to capture the crash reason to provide users with better info (i.e. need to increase the memory with shm_size – suggested as solution for #6695)

Test code to reproduce (chrome)

Can manually reproduce in Chrome in https://github.com/cypress-io/cypress-test-tiny/tree/issue-22506

  1. run npm run cypress:run-hang (enables browser debug logs with headed chrome)
  2. first spec runs, when cy.pause() starts, enter chrome://crash or chrome://hang in the URL to view behavior.

If running DEBUG=cypress* npm run cypress:run --browser chrome --headed you can see the full log output and the process_profiling logging continuously as Cypress hangs.

Cypress Version

Happening since v4.2. Current Version 10.3.0

Existing Issues Around This Behavior:

Issues to Do This Work:

  • Detect Browser Launching Crashes: #1022
  • Detect Browser Crashes: #6170 (all browsers), #1660 (electron)
  • Recover from Browser Crash: #349

Bug Reports:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:22
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
robrich7commented, Aug 1, 2022

@jennifer-shehane Hi Jennifer, can you please tell us if and when the problem will be fixed?

3reactions
robrich7commented, Jul 1, 2022

Hi @emilyrohrbough, thank you so much for checking out this issue! It has been with us for months and is very frustrating.

What I don’t understand is that it works locally on my laptop with npx cypress run, but as soon as cypress runs via docker image in a pipeline, it comes to these crashes. Can you please explain this to me?

Read more comments on GitHub >

github_iconTop Results From Across the Web

If my web browser keeps crashing, is it a problem with ... - Quora
The first thing you should try is go to the device manager on Windows and check if your trackpad shows up as a...
Read more >
Why does My PC Keep Crashing? Here're 10 Fast Fixes!
In this guide, I'll share tips I've collected to fix computer crashes and recover data from a crashed computer through reliable recovery software....
Read more >
Chrome tabs intermittent hang or crash with white screen
An immediate fix to the failed tabs can be to restart the browser, however, after a significant wait, they will regain functionality. Our...
Read more >
10 Instant Ways to Fix Computer Keeps Crashing Windows 10
Why does your PC or laptop keep crashing or freezing randomly? In this post, you will find out the reasons your computer crashes...
Read more >
Windows 11 Freezes or Crashes Randomly? Here's ... - MiniTool
If you find Windows 11 freezes on startup or after upgrade randomly, how to fix the freezing issue on your PC? Go to...
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