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

EPIPE error on Windows runs #1841

Closed
bahmutov opened this issue May 31, 2018 · 36 comments · Fixed by #2011
Closed

EPIPE error on Windows runs #1841

bahmutov opened this issue May 31, 2018 · 36 comments · Fixed by #2011
Assignees
Labels
CI General issues involving running in a CI provider OS: windows topic: EPIPE Hitting the EPIPE error when running tests type: bug
Milestone

Comments

@bahmutov
Copy link
Contributor

bahmutov commented May 31, 2018

Bug

  • Cypress v3.0.1
  • Windows
  • Node 10.1.0
  • npm 6.1.0

Saw this error on AppVeyor Windows CI https://ci.appveyor.com/project/cypress-io/cypress-example-todomvc/build/1.0.169

events.js:167
      throw er; // Unhandled 'error' event
      ^
Error: shutdown EPIPE
    at ReadStream.Socket._final (net.js:369:25)
    at callFinal (_stream_writable.js:615:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at ReadStream.onerror (_stream_readable.js:693:12)
    at ReadStream.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ cypress:run: `cypress run`

Maybe

  1. a long request that’s still in flight and being proxied when the server shuts down (since the tests pass)
  2. shutting down the http-server when there are open connections
  3. killing the child processes (?)

Need to debug with DEBUG=cypress:* to isolate the problem

@bahmutov
Copy link
Contributor Author

With debug output the last messages are

cypress:server:run final results of all runs: ...
cypress:server:cypress about to exit with code 0 +93ms
events.js:167
      throw er; // Unhandled 'error' event
      ^
Error: shutdown EPIPE
    at ReadStream.Socket._final (net.js:369:25)
    at callFinal (_stream_writable.js:615:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at ReadStream.onerror (_stream_readable.js:693:12)
    at ReadStream.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ cypress:run: `cypress run`

@bahmutov
Copy link
Contributor Author

blocking cypress-io/cypress-example-todomvc#42

@brian-mann
Copy link
Member

Right so this is with shutting everything down but unfortunately it doesn't really tell us where the problem is... you'll need to run some experiments... for instance create a test that visits a site that creates a long XHR request that is not responded to by the server.

The test will instantly pass and cypress will shut down the browser + server and exit. Does the error happen? If so then it's due to a request in flight.

@brian-mann
Copy link
Member

It could also be due to the CLI piping / massaging the stdout / stderr streams. That would be interesting.

Try to reproduce this without involving the network at all. Just have it run a tiny test without doing cy.visit() or anything. I'm pretty sure those already work since we've had two releases that have gone by and cypress-test-tiny and the example repos all pass on Windows

@bahmutov
Copy link
Contributor Author

bahmutov commented May 31, 2018

yeah, let me run the experiment with a single dummy test, then cy.visit

  • skipped all tests, error still happens

@bahmutov
Copy link
Contributor Author

bahmutov commented May 31, 2018

Hmm, found an interesting thing - there is an error from bundling step @chrisbreiding

Notice cypress\integration\integration\app_spec.js part (double "integration")

  cypress:server:controllers:spec send C:\Users\appveyor\AppData\Roaming\Cypress\cy\production\projects\cypress-example-todomvc-31c529e7c99c2a4beb3947eb6590b09f\bundles\cypress\integration\app_spec.js +1s
  cypress:browserify errored bundling C:\Users\appveyor\AppData\Roaming\Cypress\cy\production\projects\cypress-example-todomvc-31c529e7c99c2a4beb3947eb6590b09f\bundles\cypress\integration\integration\app_spec.js { Error: Cannot find module 'C:\projects\cypress-example-todomvc\cypress\integration\integration\app_spec.js' from 'C:\projects\cypress-example-todomvc'
    at C:\Users\appveyor\AppData\Local\Cypress\Cache\3.0.1\Cypress\resources\app\packages\server\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
    at load (C:\Users\appveyor\AppData\Local\Cypress\Cache\3.0.1\Cypress\resources\app\packages\server\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
    at onex (C:\Users\appveyor\AppData\Local\Cypress\Cache\3.0.1\Cypress\resources\app\packages\server\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
    at C:\Users\appveyor\AppData\Local\Cypress\Cache\3.0.1\Cypress\resources\app\packages\server\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
    at C:\Users\appveyor\AppData\Local\Cypress\Cache\3.0.1\Cypress\resources\app\packages\server\node_modules\graceful-fs\polyfills.js:284:29
    at FSReqWrap.oncomplete (fs.js:152:21)
  stream: 
   Labeled {
     _readableState: 
      ReadableState {
        objectMode: true,
        highWaterMark: 16,
        buffer: BufferList { length: 0 },
        length: 0,
        pipes: [Object],
        pipesCount: 1,
        flowing: true,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events: 
      { end: [Array],
        error: [Function],
        data: [Function: ondata],
        _mutate: [Object] },
     _eventsCount: 4,
     _maxListeners: undefined,
     _writableState: 
      WritableState {
        objectMode: true,
        highWaterMark: 16,
        finalCalled: false,
        needDrain: false,
        ending: true,
        ended: true,
        finished: true,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: false,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: true,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: false,
     allowHalfOpen: true,
     _options: { objectMode: true },
     _wrapOptions: { objectMode: true },
     _streams: [ [Object] ],
     length: 1,
     label: 'deps' },
  filePath: 'C:\\projects\\cypress-example-todomvc\\cypress\\integration\\integration\\app_spec.js',
  originalStack: 'Error: Cannot find module \'C:\\projects\\cypress-example-todomvc\\cypress\\integration\\integration\\app_spec.js\' from \'C:\\projects\\cypress-example-todomvc\'\n    at C:\\Users\\appveyor\\AppData\\Local\\Cypress\\Cache\\3.0.1\\Cypress\\resources\\app\\packages\\server\\node_modules\\browser-resolve\\node_modules\\resolve\\lib\\async.js:55:21\n    at load (C:\\Users\\appveyor\\AppData\\Local\\Cypress\\Cache\\3.0.1\\Cypress\\resources\\app\\packages\\server\\node_modules\\browser-resolve\\node_modules\\resolve\\lib\\async.js:69:43)\n    at onex (C:\\Users\\appveyor\\AppData\\Local\\Cypress\\Cache\\3.0.1\\Cypress\\resources\\app\\packages\\server\\node_modules\\browser-resolve\\node_modules\\resolve\\lib\\async.js:92:31)\n    at C:\\Users\\appveyor\\AppData\\Local\\Cypress\\Cache\\3.0.1\\Cypress\\resources\\app\\packages\\server\\node_modules\\browser-resolve\\node_modules\\resolve\\lib\\async.js:22:47\n    at C:\\Users\\appveyor\\AppData\\Local\\Cypress\\Cache\\3.0.1\\Cypress\\resources\\app\\packages\\server\\node_modules\\graceful-fs\\polyfills.js:284:29\n    at FSReqWrap.oncomplete (fs.js:152:21)\n' } +15ms
  cypress:browserify finished bundling C:\Users\appveyor\AppData\Roaming\Cypress\cy\production\projects\cypress-example-todomvc-31c529e7c99c2a4beb3947eb6590b09f\bundles\cypress\support\index.js +63ms

Same error was also in other failed build runs, just lost in all other noise.

@brian-mann
Copy link
Member

I saw this the other day... it's worrysome because it means that that error did not bubble up correctly and cause Cypress to exit with a 1 status code. There are lots of e2e tests around this behavior so something about the way this crashed is not being tested.

@AaronN-STCU
Copy link

Yeah, I encountered this same issue today after going to 3.0.1. The tests all passed, but the build fails due to this issue.

@richdom81
Copy link

richdom81 commented Jun 1, 2018

Another Stack trace from TeamCity running on Windows. I simply updated Cypress (and restarted server for good measure). Same tests were running flawlessly until the update.

events.js:160
[10:36:36][Step 2/2]       throw er; // Unhandled 'error' event
[10:36:36][Step 2/2]       ^
[10:36:36][Step 2/2] 
[10:36:36][Step 2/2] Error: shutdown EPIPE
[10:36:36][Step 2/2]     at exports._errnoException (util.js:1018:11)
[10:36:36][Step 2/2]     at Socket.onSocketFinish (net.js:237:26)
[10:36:36][Step 2/2]     at emitNone (events.js:91:20)
[10:36:36][Step 2/2]     at Socket.emit (events.js:185:7)
[10:36:36][Step 2/2]     at finishMaybe (_stream_writable.js:515:14)
[10:36:36][Step 2/2]     at endWritable (_stream_writable.js:525:3)
[10:36:36][Step 2/2]     at Socket.Writable.end (_stream_writable.js:490:5)
[10:36:36][Step 2/2]     at Socket.end (net.js:431:31)
[10:36:36][Step 2/2]     at Socket.onend (_stream_readable.js:511:10)
[10:36:36][Step 2/2]     at Socket.g (events.js:291:16)
[10:36:36][Step 2/2]     at emitNone (events.js:91:20)
[10:36:36][Step 2/2]     at Socket.emit (events.js:185:7)
[10:36:36][Step 2/2]     at endReadableNT (_stream_readable.js:974:12)
[10:36:36][Step 2/2]     at _combinedTickCallback (internal/process/next_tick.js:80:11)
[10:36:36][Step 2/2]     at process._tickCallback (internal/process/next_tick.js:104:9)

@zerdos
Copy link

zerdos commented Jun 5, 2018

Cypress 3.0.1
windows 10,
Node 10.3

(The issue is not reproducable with node 8)

@matt-psaltis
Copy link

We're seeing it on 3.0.1 on Server 2012 with Node 8.11.2

@zerdos
Copy link

zerdos commented Jun 5, 2018

Couldn't reproduce it with Node 8.11.2

@benpolinsky
Copy link

Seeing this on 3.0.1
Windows 10
Node 10.1

@brian-mann
Copy link
Member

This is likely with the CLI now piping the stdio of the binary in Windows, and is likely not a problem with the binary itself.

The binary ships with its own node version, so whatever one you have locally installed does not affect the binary. However the CLI does run in your own node version, so if by changing the node version it fixes the problem, then that would be the root cause.

Can someone work with the CLI regarding piping stdio and see if they can see the root cause? We are still trying to reproduce on our end to even begin debugging this.

@zerdos
Copy link

zerdos commented Jun 8, 2018

How to reproduce:
Windows 10, with node 10 installed, (also yarn 1.7)

mkdir cypress-test && cd cpress-test
yarn init 
yarn add --dev cypress
yarn cypress open # this scaffolds and adds example files
yarn cypress run 

@kayvanbree
Copy link

kayvanbree commented Jun 8, 2018

Got the same error on Windows on node version 8! Running tests with cypress open works fine. I use cypress-cucumber-preprocessor.

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: shutdown EPIPE
    at _errnoException (util.js:1022:11)
    at Socket.onSocketFinish (net.js:307:25)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at finishMaybe (_stream_writable.js:614:14)
    at endWritable (_stream_writable.js:622:3)
    at Socket.Writable.end (_stream_writable.js:573:5)
    at Socket.end (net.js:509:31)
    at Socket.onend (_stream_readable.js:595:10)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cypress:run: `cypress run`
npm ERR! Exit status 1
Angular CLI: 6.0.5
Node: 8.11.1
OS: win32 x64
Angular: 6.0.3

@zerdos
Copy link

zerdos commented Jun 8, 2018

  cypress:server:cypress about to exit with code 0 +17s
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: shutdown EPIPE
    at ReadStream.Socket._final (net.js:366:25)
    at callFinal (_stream_writable.js:612:10)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at ReadStream.onerror (_stream_readable.js:687:12)
    at ReadStream.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cypress:run: `cypress run`
npm ERR! Exit status 1

@beanian
Copy link

beanian commented Jun 13, 2018

Any workarounds for this at the moment? I'm seeing this issue in my VSTS pipeline when performing a cypress run. Works fine on the box directly but when part of a pipeline it blows up

@maccurt
Copy link

maccurt commented Jun 13, 2018

I am seeing this error also on my jenkins run. I did just install cypress brand new globally because it was installing and unzipping every time, which was taking 5 minutes. Perhaps this newer version broke something or more likely I did something wrong. ha ha

@stilren
Copy link

stilren commented Jun 13, 2018 via email

@maccurt
Copy link

maccurt commented Jun 13, 2018

I also downgraded to 2.1 and it worked for me.

@zerdos
Copy link

zerdos commented Jun 14, 2018

The bug disappeared with node 10.4.1 (on teamcity server)

@kuceb
Copy link
Contributor

kuceb commented Jun 14, 2018

Who here is installing Cypress globally?

This is something we don't test extensively because it's not recommended, so it could be a source of problems

@maccurt
Copy link

maccurt commented Jun 14, 2018

I installed it globally on one of our Jenkins Agent, because every time we ran our jenkins job it was deleting the work space and re-installing Cypress. The install and unzipping of cypress was taking 5-6 minutes sometimes and this was timing out our Octopus job that were waiting for our test to pass. Not sure if this is the correct way to do it. We could not delete the works space, our delete everything else and leave the cypress node module there. I would also have to make sure everyone in our org is using the same version of cypress.

@kuceb
Copy link
Contributor

kuceb commented Jun 14, 2018

Cypress changed in 3.0, now it installs the binary outside the project, so you can cache that without worrying about caching node_modules.
https://docs.cypress.io/guides/guides/continuous-integration.html#

If you can ensure ~/.cache gets preserved, Cypress won't have to reinstall!

@matt-psaltis
Copy link

matt-psaltis commented Jun 15, 2018

I've just checked with this new information coming in:

  • We don't have Cypress installed globally. (only gulp and yarn)
  • Node 10.4.1 has not fixed it for us on TeamCity server.

Happens from both cmd.exe and powershell.exe
Interestingly, it happens even if there's no tests run.

@zerdos
Copy link

zerdos commented Jun 15, 2018 via email

@uoziod
Copy link

uoziod commented Jun 18, 2018

Guys, any news on this one? It's pretty ugly one :(

@matt-psaltis
Copy link

@zerdos I don't use the teamcity reporter. I am using the webpack plugin however in case that's relevant.

@richdom81
Copy link

@zerdos I use the teamcity reporter.
I'm getting this error, though I have not tried updating Node.js

@brian-mann
Copy link
Member

Looking into this now...

@brian-mann brian-mann self-assigned this Jun 21, 2018
@brian-mann brian-mann added this to the 3.0.2 milestone Jun 21, 2018
@brian-mann
Copy link
Member

Good news - was able to reproduce this, but only in some specific versions of node.

brian-mann added a commit that referenced this issue Jun 21, 2018
@vladjerca
Copy link

@brian-mann Do you have any idea when this will be released?

@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: in progress stage: needs investigating Someone from Cypress needs to look at this stage: proposal 💡 No work has been done of this issue stage: needs review The PR code is done & tested, needs review stage: ready for work The issue is reproducible and in scope labels Jun 27, 2018
@brian-mann
Copy link
Member

Released in 3.0.2.

@bahmutov bahmutov added the topic: EPIPE Hitting the EPIPE error when running tests label Sep 23, 2020
@leilafi
Copy link

leilafi commented May 6, 2022

I am getting this error again in Cypress 9.6.0. Anyone else? My node version is v16.13.0.

@jennifer-shehane jennifer-shehane added CI General issues involving running in a CI provider and removed CI: appveyor labels Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI General issues involving running in a CI provider OS: windows topic: EPIPE Hitting the EPIPE error when running tests type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.