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

Websocket Connection Closed: When BrowserCriClient destroys an extra target while that target is being initialized, the App crashes #30100

Closed
cacieprins opened this issue Aug 23, 2024 · 3 comments · Fixed by #30174
Assignees

Comments

@cacieprins
Copy link
Contributor

Current behavior

If BrowserCriClient's _onTargetDestroyed event handler is triggered while the _onAttachToTarget event handler is pending the Fetch.enable CRI command, the app can crash with an uncaught exception, Error: WebSocket connection closed.

This is a separate manifestation of the WebSocket connection closed issue that was resolved in the CriClient class in v13.13.1.

Desired behavior

No response

Test code to reproduce

None currently, but should be reproducible with a unit test in packages/server/test/unit/browsers/browser-cri-client_spec.ts

Cypress Version

13.13.1

Node version

18.17.1

Operating System

OSX 14.3

Debug Logs

2024-08-23T01:22:08.390Z cypress:server:browsers:browser-cri-client Target.attachedToTarget { targetId: 'EB14338F830B61BC0944C09E4C812677', type: 'page', title: '', url: '', attached: true, canAccessOpener: false, browserContextId: 'BB40F3CCEE2CA5D8CB25D667E5AB23E2' }
2024-08-23T01:22:08.395Z cypress:server:browsers:browser-cri-client Connect as extra target (id: EB14338F830B61BC0944C09E4C812677)
WebSocket connection closed
2024-08-23T01:22:08.434Z cypress:server:browsers:browser-cri-client Target.targetDestroyed { event: { targetId: 'EB14338F830B61BC0944C09E4C812677' }, closing: false, closed: false, resettingBrowserTargets: false }
2024-08-23T01:22:08.434Z cypress:server:browsers:browser-cri-client Close extra target client (id: %s)
Error: WebSocket connection closed
    at _._handleConnectionClose (<embedded>:628:580021)
    at A.<anonymous> (<embedded>:628:578085)
    at Object.onceWrapper (node:events:629:26)
    at A.emit (node:events:514:28)
    at A.emitClose (<embedded>:628:558309)
    at Socket.H (<embedded>:628:565620)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:323:12)

Other

No response

@jennifer-shehane jennifer-shehane changed the title When BrowserCriClient destroys an extra target while that target is being initialized, the App crashes Websocket Connection Closed: When BrowserCriClient destroys an extra target while that target is being initialized, the App crashes Aug 26, 2024
@allenbilar
Copy link

Hello, any update on this? We're consistently experience this failure on our automated test in CI. Would like to know when the fix can be possibly released? Thanks!

image

image

@jennifer-shehane
Copy link
Member

@allenbilar There's a PR open that will hopefully fix this. We won't really know until it's released and used by users to ensure this covers all of these issues. #30174

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 4, 2024

Released in 13.14.2.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.14.2, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants