cypress-io / cypress

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

Cypress crashes on SIGINT #29228

Open krishantaylor opened 5 months ago

krishantaylor commented 5 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 5 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 5 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 5 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 5 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 3 months ago

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

robbporto commented 2 weeks ago

Same thing on macOS 14.6.1.

Sinled commented 3 hours ago

Same for cypress 13.13.1 and macOS 14.6.1

cypress 13.3.0 works fine though