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

CLI does not detect killed Electron process with SIGKILL, SIGBUS etc #5808

Closed
bahmutov opened this issue Nov 27, 2019 · 2 comments · Fixed by #5810 · May be fixed by ngChile/ngx-devkit-cypress-builder#20 or qsays/grafana#1
Closed
Assignees
Labels
cli type: unexpected behavior User expected result, but got another

Comments

@bahmutov
Copy link
Contributor

Cypress v3.6

  • start Cypress CLI
npx cypress open
const child = cp.spawn(executable, electronArgs, stdioOptions)

function resolveOn (event) {
  return function (code, signal) {
    debug('child event fired %o', { event, code, signal })
    resolve(code)
  }
}

child.on('close', resolveOn('close'))
child.on('exit', resolveOn('exit'))
child.on('error', reject)
  • if the child process is killed for some reason, for example with
$ ps
66579 ttys005    0:00.47 node /Users/gleb/.nvm/versions/node/v12.13.0/bin/npx cypress open
66580 ttys005    0:02.83 /Users/gleb/Library/Caches/Cypress/3.6.1/Cypress.app/Contents/MacOS/Cypress 
$ kill -9 66580

then our CLI receives code: null and thinks everything is peachy

DEBUG=cypress:cli npx cypress open
  cypress:cli child event fired { event: 'exit', code: null, signal: 'SIGKILL' } +14s
  cypress:cli child event fired { event: 'close', code: null, signal: 'SIGKILL' } +1ms
$ echo $?
0

Seems SIGBUS is sent to the child process when it runs out of shared memory space for example https://stackoverflow.com/questions/53902507/unknown-error-session-deleted-because-of-page-crash-from-unknown-error-cannot/53970825#53970825

Proposal

Only exit with code 0 when the child process successfully finishes with code: 0, signal: null

@bahmutov bahmutov self-assigned this Nov 27, 2019
@bahmutov bahmutov added cli type: unexpected behavior User expected result, but got another labels Nov 27, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Nov 27, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Nov 27, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 27, 2019

The code for this is done in cypress-io/cypress#5810, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 27, 2019

Released in 3.7.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli type: unexpected behavior User expected result, but got another
Projects
None yet
1 participant