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

cypress.run() does not release activeHandles since 3.5.0, wrapping script doesn't exit. #7454

Closed
dubbha opened this issue May 22, 2020 · 4 comments

Comments

@dubbha
Copy link

dubbha commented May 22, 2020

Current behavior:

cypress.run() does not release some activeHandles since 3.5.0. Wrapping script doesn't exit without an explicit process.exit().

Same situation in 4.5.0, and probably all the versions starting 3.5.0. Worked seamlessly in 3.4.1.

Desired behavior:

No activeHandles/activeRequests should stuck, the wrapping script should exit cleanly, without an explicit forceful process.exit() call.

Test code to reproduce

activeHandles@3.4.1 [OK, last good version]
activeHandles@3.5.0 [NOK, first problematic version]
activeHandles@4.5.0 [NOK, still bad in 4.5.0]

// package.json
"scripts": {
  "cy:report": "node ./cypress/scripts/report.js"
},

// console
$ yarn cy:report

The wrapping script:

#!/usr/bin/env node

const cypress = require('cypress')

main()
// process.exit()  // this would "help" but should not be needed

async function main() {
    const result = await cypress.run()

    console.log(result)
    console.log(process._getActiveHandles())
    console.log(process._getActiveRequests())
}

Versions

Windows 10
Cypress 3.5.0+ (e.g. 4.5.0)

@cypress-bot cypress-bot bot added the stage: needs investigating Someone from Cypress needs to look at this label May 26, 2020
@jennifer-shehane
Copy link
Member

jennifer-shehane commented May 26, 2020

Can you explain a bit more about the exact behavior you are seeing that is different between version? When I run the provided code, the process does exit for me. I'm using macOS.

Both the 3.4.1 and the 4.6.0 versions exit and also print activeHandlers and activeRequests in the process log after the run has finished.

May be isolated to Windows if you're seeing something different here.

4.6.0 log with DEBUG logs

  cypress:server:cypress about to exit with code 0 +6s
  cypress:cli child event fired { event: 'exit', code: 0, signal: null } +7s
  cypress:cli child event fired { event: 'close', code: 0, signal: null } +1ms
[ WriteStream {
    connecting: false,
    _hadError: false,
    _handle:
     TTY {
       onread: [Function: onStreamRead],
       [Symbol(owner)]: [Circular] },
....
// process exits after console.logs

@cypress-bot cypress-bot bot added stage: needs information Not enough info to reproduce the issue and removed stage: needs investigating Someone from Cypress needs to look at this labels May 26, 2020
@dubbha
Copy link
Author

dubbha commented May 26, 2020

Hi Jennifer,

Not much to add regarding the expected behavious - I expect the parent script to exit cleanly in all the versions.

Basically, I expect it to behave as it does in 3.4.1:
Co3rQri76T

While starting 3.5.0 it doesn't (screen taken at 4.5.0):

9FqQg5u2MP

OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.18363 N/A Build 18363

My assumption was that the root cause is that some of the child processes do not release some activeHandlers, so the partent process is stuck, so I added the getActiveHandles and getActiveRequests outputs. But I can't debug it any further, because their outputs are not exactly clear to me. So I might be wrong, and the reason might be elsewhere.

@jennifer-shehane
Copy link
Member

I think this is isolated to Windows because this is not the behavior I see. The process exits properly on MacOS on all of these versions.

@jennifer-shehane
Copy link
Member

Since this issue hasn't had activity in a while, we'll close the issue until we can confirm this is still happening. Please comment if there is new information to provide concerning the original issue and we'd be happy to reopen.

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants