cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.51k stars 3.2k forks source link

Cypress crashes on SIGINT #29228

Open krishantaylor opened 8 months ago

krishantaylor commented 8 months ago

Current behavior

I'm running cypress and a few other commands using foreman. After tests have run, I Ctrl+C to quit foreman. This used to work fine, but now I'm always receiving a crash report for cypress when exiting. The crash happens when no tests are run as well. This message now displays in the logs for cypress:

We detected that the Chrome browser process closed unexpectedly. We have failed the current spec and aborted the run.

Desired behavior

Cypress and Chrome should quit gracefully.

Test code to reproduce

.

Cypress Version

13.7.0

Node version

v18.19.1

Operating System

macOS 14.3.1

Debug Logs

No response

Other

I verified the desired behavior with v13.6.6, so this may have something to do with the recently upgraded signal-exit package.

jennifer-shehane commented 8 months ago

Could you run Cypress in debug mode mode and print the entire set of logs here when you exit the process?

jmosley5 commented 8 months ago

If it's okay to add, I'm experiencing the same, while only running Cypress. I'm used to opening and closing Cypress dashboard through the terminal

Example: To Open: cy:open And, then closing using the terminal: CTRL + C

Now I get the same error described @krishantaylor.

krishantaylor commented 8 months ago

It doesn't crash in debug mode.

This triggers the crash.

> yarn cypress open --e2e --browser chrome

# Ctrl+C
We detected that the Chrome browser process closed unexpectedly.

We have failed the current spec and aborted the run.

This doesn't trigger a crash.

> DEBUG=cypress:* yarn cypress open --e2e --browser chrome

# Ctrl+C
write EPIPE
Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:931:11)
    at Socket._write (node:net:943:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Socket.write (node:internal/streams/writable:337:10)
    at e.log (<embedded>:1:110372)
    at i (<embedded>:1:103195)
    at v._onTargetDestroyed (<embedded>:4291:102687)
    at _.<anonymous> (<embedded>:4291:100158)
    at _.emit (node:events:514:28)
    at _._handleMessage (<embedded>:2262:580235)
    at A.<anonymous> (<embedded>:2262:579669)
    at A.emit (node:events:514:28)
    at f.U (<embedded>:2262:564853)
    at f.emit (node:events:514:28)
    at f.dataMessage (<embedded>:2262:545228)
    at f.getData (<embedded>:2262:544410)
    at f.startLoop (<embedded>:2262:541117)
    at f._write (<embedded>:2262:540472)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at f.write (node:internal/streams/writable:337:10)
    at Socket.W (<embedded>:2262:565539)
    at Socket.emit (node:events:514:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
MikeMcC399 commented 8 months ago

We detected that the electron tab running Cypress tests closed unexpectedly.

We have failed the current spec and aborted the run.

is logged when then Cypress Runner window is closed using the menu selection (File > Close Window)

Until the last Cypress 12.x version, no error was output and starting from Cypress 13.0.0 the error message is output when closing the window. In this case there is no Ctrl-C being used.

Since the repro steps are different and this issue says it was still working in Cypress 13.6.6 I have kept the issues separate.

esetnik commented 6 months ago

I'm seeing the same thing on macOS 14.5 (23F79)

robbporto commented 2 months ago

Same thing on macOS 14.6.1.

Sinled commented 2 months ago

Same for cypress 13.13.1 and macOS 14.6.1

cypress 13.3.0 works fine though

mad-shox commented 2 months ago

The same mistake, "cypress": "^13.14.2", macOs 15.0

MikeMcC399 commented 1 month ago

@alvincrespo

I was running into this issue with my CircleCI integration after upgrading to 13.15.1. I worked around the issue by updating my node orb to circleci/node@6.3.0

That sounds like a different issue. This one is about running Cypress locally, not in CI, and attempting to close it down with Ctrl-C.

alvincrespo commented 1 month ago

@MikeMcC399 Ah yeah, sorry about that. I'll delete my comment so folks don't get confused. Thank you!