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

SIGSEGV error when quitting Cypress when Electron browser is open #9164

Closed
bahmutov opened this issue Nov 10, 2020 · 7 comments
Closed

SIGSEGV error when quitting Cypress when Electron browser is open #9164

bahmutov opened this issue Nov 10, 2020 · 7 comments
Assignees
Labels
topic: SIG errors Program error signals, ie SIGILL, SIGSEGV, SIGBUS, SIGABRT

Comments

@bahmutov
Copy link
Contributor

Cypress v5.6.0, both released version and develop branch
MacOS

  • open Cypress
  • run spec using the bundled Electron browser
  • while the Electron browser is in focus click "Cmd+Q" (quit command) using the keyboard

Screen Shot 2020-11-10 at 3 34 25 PM

  • click on "Report" button to see the details

Screenshot

Screen Shot 2020-11-10 at 3 34 52 PM

Text details

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000128
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [42449]

VM Regions Near 0x128:
--> 
    __TEXT                 00000001011c3000-00000001011eb000 [  160K] r-x/r-x SM=COW  /Users/USER/*/Cypress.app/Contents/MacOS/Cypress

Application Specific Information:
Calling windowShouldClose: on the delegate for the ElectronNSWindow 0x7fbe214e3df0

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.Electron.framework 	0x00000001082eff67 ElectronInitializeICUandStartNode + 1160295
1   com.apple.CoreFoundation      	0x00007fff39a6389f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
2   com.apple.CoreFoundation      	0x00007fff39a63833 ___CFXRegistrationPost1_block_invoke + 63
3   com.apple.CoreFoundation      	0x00007fff39a637a8 _CFXRegistrationPost1 + 372

Always reproducible

@bahmutov bahmutov self-assigned this Nov 10, 2020
@bahmutov bahmutov added the topic: SIG errors Program error signals, ie SIGILL, SIGSEGV, SIGBUS, SIGABRT label Nov 10, 2020
@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Nov 10, 2020
@bahmutov
Copy link
Contributor Author

bahmutov commented Nov 10, 2020

Note: when using "Quit" via Cypress Menu, the app exits without crashing

Correction: sometimes it DOES crash too

@bahmutov
Copy link
Contributor Author

bahmutov commented Nov 10, 2020

Running with DEBUG=* and crashing, the log messages after pressing Cmd+Q

  cypress:server:browsers:electron close fired on the BrowserWindow { browserWindowUrl: 'https://orders.stg.redrooster.com.au/__/#/tests/integration/spec.js' } +12s
  cypress:server:browsers killing browser process +14s
  cypress:server:saved_state making saved state from /Users/gleb/git/cypress/packages/server +15s
  cypress:server:saved_state for project path /Users/gleb/git/cypress-test-tiny +0ms
  cypress:server:browsers:electron debugger detached due to { reason: 'target closed' } +37ms
  cypress:server:browsers:electron closed event fired +2ms
  cypress:server:windows error removing all extensions { err: TypeError: Object has been destroyed at Object.removeAllExtensions (/Users/gleb/git/cypress/packages/server/lib/gui/windows.ts:51:26) at BrowserWindow.<anonymous> (/Users/gleb/git/cypress/packages/server/lib/browsers/electron.js:366:19)     at Object.onceWrapper (events.js:417:26)     at BrowserWindow.emit (events.js:322:22) at tryToCall (/Users/gleb/git/cypress/packages/server/lib/browsers/electron.js:27:27) at EventEmitter.kill (/Users/gleb/git/cypress/packages/server/lib/browsers/electron.js:377:20) at /Users/gleb/git/cypress/packages/server/lib/browsers/index.js:34:14 at Promise.cancellationExecute [as _execute] (/Users/gleb/git/cypress/packages/server/node_modules/bluebird/js/release/debuggability.js:449:9) at Promise._resolveFromExecutor (/Users/gleb/git/cypress/packages/server/node_modules/bluebird/js/release/promise.js:518:18) at new Promise (/Users/gleb/git/cypress/packages/server/node_modules/bluebird/js/release/promise.js:103:10) at process.kill (/Users/gleb/git/cypress/packages/server/lib/browsers/index.js:21:10)     at Object.onceWrapper (events.js:417:26)     at process.emit (events.js:322:22) at process.emit (/Users/gleb/git/cypress/node_modules/source-map-support/source-map-support.js:495:21) at processEmit [as emit] (/Users/gleb/git/cypress/node_modules/signal-exit/index.js:155:35)     at App.<anonymous> (electron/js2c/browser_init.js:185:1271)     at App.emit (events.js:310:20) at BrowserWindow.onClose (/Users/gleb/git/cypress/packages/server/lib/modes/interactive.js:56:24) at BrowserWindow.<anonymous> (/Users/gleb/git/cypress/packages/server/lib/gui/windows.ts:166:32)     at Object.onceWrapper (events.js:417:26)     at BrowserWindow.emit (events.js:322:22) , extensions: undefined } +18s
  cypress:server:preprocessor removeFile /Users/gleb/git/cypress-test-tiny/cypress/integration/spec.js +14s
  cypress:server:preprocessor base emitter plugin close event +1ms
  cypress:server:preprocessor base emitter native close event +0ms
  cypress:server:preprocessor base emitter native close event +0ms
  cypress:server:events sending ipc data { type: 'launch:browser', data: { id: 0.9731387938357738, data: { browserClosed: true } }, originalData: { id: 0.9731387938357738, data: { browserClosed: true } } } +7s
  cypress:server:browsers browser process killed +8ms
  cypress:webpack close /Users/gleb/git/cypress-test-tiny/cypress/integration/spec.js +12s
  cypress:electron electron closing { code: null, errCode: 'SIGSEGV' } +21s
  cypress:electron calling callback with code null +0ms
  cypress:server:cypress electron finished with null +21s
  cypress:cli child event fired { event: 'exit', code: 0, signal: null } +21s
  cypress:cli child event fired { event: 'close', code: 0, signal: null } +2ms
  yarn "child" blocking queue finally resolved. Nothing to worry about. +17s
✨  Done in 23.04s.

@bahmutov
Copy link
Contributor Author

Without crash:

If we first close the Electron browser we see the messages

  cypress:server:browsers:electron close fired on the BrowserWindow { browserWindowUrl: 'https://orders.stg.redrooster.com.au/__/#/tests/integration/spec.js' } +3s
  cypress:server:browsers:electron closed event fired +22ms
  cypress:server:windows error removing all extensions { err: TypeError: Object has been destroyed at Object.removeAllExtensions (/Users/gleb/git/cypress/packages/server/lib/gui/windows.ts:51:26) at BrowserWindow.<anonymous> (/Users/gleb/git/cypress/packages/server/lib/browsers/electron.js:366:19)     at Object.onceWrapper (events.js:417:26)     at BrowserWindow.emit (events.js:322:22) , extensions: undefined } +9s
  cypress:server:preprocessor removeFile /Users/gleb/git/cypress-test-tiny/cypress/integration/spec.js +5s
  cypress:server:preprocessor base emitter plugin close event +0ms
  cypress:server:preprocessor base emitter native close event +0ms
  cypress:server:preprocessor base emitter native close event +0ms
  cypress:webpack close /Users/gleb/git/cypress-test-tiny/cypress/integration/spec.js +3s
  cypress:server:events sending ipc data { type: 'launch:browser', data: { id: 0.46615139032480646, data: { browserClosed: true } }, originalData: { id: 0.46615139032480646, data: { browserClosed: true } } } +5s
  cypress:server:browsers:electron debugger detached due to { reason: 'target closed' } +13ms
[43666:1110/154410.189774:ERROR:shared_image_manager.cc(143)] SharedImageManager::ProduceGLTexture: Trying to produce a representation from a non-existent mailbox. 17:DC:A5:E2:5A:99:E4:CC:05:66:FD:C3:FD:C5:BB:BF
[43666:1110/154410.189936:ERROR:gles2_cmd_decoder.cc(18929)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoCreateAndTexStorage2DSharedImageINTERNAL: invalid mailbox name
[43666:1110/154410.189998:ERROR:gles2_cmd_decoder.cc(18950)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoBeginSharedImageAccessCHROMIUM: bound texture is not a shared image
[43666:1110/154410.190051:ERROR:gles2_cmd_decoder.cc(13814)] [.DisplayCompositor]GL ERROR :GL_INVALID_VALUE : glScheduleCALayerCHROMIUM: unsupported texture format
[43666:1110/154410.194698:ERROR:gles2_cmd_decoder.cc(18979)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : DoEndSharedImageAccessCHROMIUM: bound texture is not a shared image
  socket.io:client client close with reason transport close +3s
  socket.io:socket closing socket - reason transport close +3s
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 62403 } +6s

Then if we click "Cmd+Q" over Desktop GUI we see messages

  cypress:electron electron closing { code: 0, errCode: null } +14s
  cypress:electron calling callback with code 0 +1ms
  cypress:server:cypress electron finished with 0 +14s
  cypress:cli child event fired { event: 'exit', code: 0, signal: null } +15s
  cypress:cli child event fired { event: 'close', code: 0, signal: null } +1ms
  yarn "child" blocking queue finally resolved. Nothing to worry about. +11s

@bahmutov
Copy link
Contributor Author

Commenting out attaching the debugger seems to reliably stop the crash

// packages/server/lib/browsers/electron.js
return Bluebird.try(() => {
  // return this._attachDebugger(win.webContents)
})

Of course, the test does not run fully, since Cypress cannot communicate with the browser correctly

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 1, 2021

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

@flotwig flotwig closed this as completed Apr 1, 2021
@bahmutov
Copy link
Contributor Author

bahmutov commented Apr 2, 2021

I don't see the crash anymore in 7.0-release branch

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 5, 2021

Released in 7.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: SIG errors Program error signals, ie SIGILL, SIGSEGV, SIGBUS, SIGABRT
Projects
None yet
Development

No branches or pull requests

2 participants