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

Detect and cleanly exit from renderer crashes #6189

Closed
wants to merge 44 commits into from

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Jan 17, 2020

User facing changelog

  • Cypress will now detect if your browser tab has crashed and will cleanly exit.

Additional details

  • previously, Cypress would hang open until the CI job timed out
  • methods used to tell if the browser tab has crashed:
    • if the user is not cy.visiting, and the socket disconnects, and there is not a new runner connection within 5 seconds, the browser tab crashed
    • if the user is cy.visiting, the socket disconnects, and it does not reconnect within 10 seconds (generous)
    • this makes the code a lot more complex, maybe the rules should just be "if the runner disconnects, and it does not reconnect within 10 seconds, the browser tab crashed" - don't try to be smart about it
      • apparently socket.io can and will disconnect and reconnect, so there should be a delay in either case
      • since 10 seconds is kinda a long delay, maybe these two cases should remain separate
  • what do we do when an unexpected exit does occur?
    • browser is left open for debugging
    • in open mode: a warning is logged to stdio
    • in run mode: an error is thrown and tests end
  • if the extension d/c's in run mode, force exit
  • keep extension d/c error message the same

Most of the meat of the error has been moved to the docs. Docs PR: cypress-io/cypress-documentation#2413

User Experience Changes

  • users will now see the BROWSER_CRASHED error message in stdout if the browser crashes in open mode
  • users will see their tests exit early if the browser crashes, or if the extension disconnects, in run mode
  • webextension disconnections now cause tests to end in run mode

PR Tasks

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 17, 2020

Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.

  • Please write [WIP] in the title of your Pull Request if your PR is not ready for review - someone will review your PR as soon as the [WIP] is removed.
  • Please familiarize yourself with the PR Review Checklist and feel free to make updates on your PR based on these guidelines.

PR Review Checklist

If any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'.

User Experience

  • The feature/bugfix is self-documenting from within the product.
  • The change provides the end user with a way to fix their problem (no dead ends).

Functionality

  • The code works and performs its intended function with the correct logic.
  • Performance has been factored in (for example, the code cleans up after itself to not cause memory leaks).
  • The code guards against edge cases and invalid input and has tests to cover it.

Maintainability

  • The code is readable (too many nested 'if's are a bad sign).
  • Names used for variables, methods, etc, clearly describe their function.
  • The code is easy to understood and there are relevant comments explaining.
  • New algorithms are documented in the code with link(s) to external docs (flowcharts, w3c, chrome, firefox).
  • There are comments containing link(s) to the addressed issue (in tests and code).

Quality

  • The change does not reimplement code.
  • There's not a module from the ecosystem that should be used instead.
  • There is no redundant or duplicate code.
  • There are no irrelevant comments left in the code.
  • Tests are testing the code’s intended functionality in the best way possible.

Internal

  • The original issue has been tagged with a release in ZenHub.

@flotwig flotwig force-pushed the issue-6170-detect-renderer-crashes branch from f01c582 to e22ab18 Compare January 17, 2020 18:47
@cypress
Copy link

cypress bot commented Jan 17, 2020



Test summary

6954 0 97 0


Run details

Project cypress
Status Passed
Commit 0e74adf
Started Mar 16, 2020 3:23 PM
Ended Mar 16, 2020 3:29 PM
Duration 06:08 💡
OS Linux Debian - 10.1
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@chrisbreiding chrisbreiding removed their request for review March 2, 2020 13:53
@flotwig flotwig changed the title Detect and cleanly exit from renderer crashes [WIP] Detect and cleanly exit from renderer crashes Mar 16, 2020
@flotwig flotwig marked this pull request as draft April 20, 2020 15:13
@flotwig flotwig changed the title [WIP] Detect and cleanly exit from renderer crashes Detect and cleanly exit from renderer crashes Apr 20, 2020
@flotwig flotwig closed this Sep 25, 2020
@flotwig flotwig deleted the issue-6170-detect-renderer-crashes branch January 24, 2022 18:19
@flotwig flotwig restored the issue-6170-detect-renderer-crashes branch February 14, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect browser/renderer crashes
3 participants