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

Missing browserCriClient in connectToNewSpec #27657

Closed
joshkaplan opened this issue Aug 24, 2023 · 21 comments · Fixed by #29663
Closed

Missing browserCriClient in connectToNewSpec #27657

joshkaplan opened this issue Aug 24, 2023 · 21 comments · Fixed by #29663
Assignees
Labels
Reproducible Can be reproduced stage: needs investigating Someone from Cypress needs to look at this type: bug

Comments

@joshkaplan
Copy link

joshkaplan commented Aug 24, 2023

Current behavior

Sometimes when running tests (in CD, in docker), cypress simply fails.

We see:

Timed out waiting for the browser to connect. Retrying...
Error: Missing browserCriClient in connectToNewSpec

And then cypress.run returns:

{
  "failures": 1,
  "message": "Could not find Cypress test run results"
}

Notes:

  • we are running using the module api.
  • We are also using --quiet
  • It happens lot in 1 project in particular (~50% of the time):
    • For this project, it happens in the same place every time: after the first spec in the project has completed, and before the second spec has started
    • The first spec passes, and everything looks fine in the video
  • It also happens sporadically in other projects (3-4% of the time)

Desired behavior

tests to run without crashing (or some indication of what is being done incorrectly)

Test code to reproduce

unsure how to reliably reproduce. most projects run fine most of the time.

Cypress Version

12.17.3

Node version

16.20.0

Operating System

Linux / docker

Debug Logs

No response

Other

Looks like the same problem as #27241 and #24650

@joshkaplan
Copy link
Author

here's a couple of snippets from the debug output with DEBUG=cypress*

can't share the entire thing here, since it's huge and contains sensitive info. if there are select modules we should capture, could try that.

note that "sem-pages" is the 2nd spec in this project

2023-08-25T20:53:31.876Z cypress:server:run spec results { [REDACTED] }
2023-08-25T20:53:31.877Z cypress:server:run about to run spec { spec: { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' }, isHeadless: true, browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:53:31.877Z cypress:server:run created videoRecording { videoRecording: { api: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, controller: undefined } }
2023-08-25T20:53:31.877Z cypress:server:run waiting for socket to connect and browser to launch...
2023-08-25T20:53:31.877Z cypress:server:run waiting for socket connection... { id: '9n454ipst4' }
2023-08-25T20:53:31.877Z cypress:server:open_project resetting project state, preparing to launch browser chrome for spec { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' } options { projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning] }
2023-08-25T20:53:31.878Z cypress:server:project resetting project instance /pokey/tests/frontend/editorial-pages/cypress
2023-08-25T20:53:31.878Z cypress:proxy:http:util:buffers resetting buffers
2023-08-25T20:53:31.879Z cypress:server:open_project launching browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, spec: integration/sem-pages.test.ts
2023-08-25T20:53:31.879Z cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Module._load "./chrome"
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts" (module-fullpath:node | Module._cache) -> moduleCache: 901, exportsCache: 3760, loaded: 900
2023-08-25T20:53:31.879Z cypress-verbose:packherd:trace Resolved "./chrome" via module-fullpath:node (packages/server/lib/browsers/chrome.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts)
2023-08-25T20:53:31.880Z cypress:server:browsers:chrome connecting to new chrome tab in existing instance with url and debugging port {
  url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts'
}
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Inspector.targetCrashed' }
2023-08-25T20:53:31.880Z cypress:server:browsers:chrome attaching listeners to chrome { url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts', options: { onInitializeNewBrowserTab: [AsyncFunction: s], browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts', browsers: [ [Object], [Object] ], userAgent: 'Cypress bot', proxyUrl: 'http://localhost:40607', proxyServer: 'http://localhost:40607', socketIoRoute: '/__socket', chromeWebSecurity: false, isTextTerminal: true, downloadsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads', experimentalModifyObstructiveThirdPartyCode: false, experimentalWebKitSupport: false, projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning], onBrowserClose: [Function (anonymous)] } }
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.requestWillBeSent' }
2023-08-25T20:53:31.880Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.responseReceived' }
2023-08-25T20:53:31.880Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 1, method: 'Network.enable', params: { maxTotalBufferSize: 0, maxResourceBufferSize: 0, maxPostDataSize: 0 } }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 1, result: {} }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 2, method: 'Page.enable', params: {} }
2023-08-25T20:53:31.881Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 2, result: {} }
2023-08-25T20:53:31.882Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 3, method: 'Storage.clearDataForOrigin', params: { origin: '*', storageTypes: 'all' } }
2023-08-25T20:53:31.882Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 4, method: 'Network.clearBrowserCache', params: {} }
2023-08-25T20:53:31.884Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 3, result: {} }
2023-08-25T20:53:31.885Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 4, result: {} }
2023-08-25T20:53:31.897Z cypress:server:video capture started { command: "ffmpeg -n 20 /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f image2pipe -use_wallclock_as_timestamps 1 -i pipe:0 -y -vcodec libx264 -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' -preset ultrafast /pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4" }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' }
2023-08-25T20:53:31.897Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 5, method: 'Page.setDownloadBehavior', params: { behavior: 'allow', downloadPath: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads' } }
2023-08-25T20:53:31.897Z cypress:server:run setting videoController for videoRecording { api: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, controller: undefined }
2023-08-25T20:53:31.897Z cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.screencastFrame' }
2023-08-25T20:53:31.897Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 6, method: 'Page.startScreencast', params: { format: 'jpeg', everyNthFrame: 5 } }
2023-08-25T20:53:31.898Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 5, result: {} }
2023-08-25T20:53:31.898Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { method: 'Page.screencastVisibilityChanged', params: { visible: true } }
2023-08-25T20:53:31.899Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 6, result: {} }
2023-08-25T20:53:31.899Z cypress:server:browsers:chrome received CRI client
2023-08-25T20:53:31.899Z cypress:server:browsers:chrome navigating to page https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:53:31.899Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 7, method: 'Page.bringToFront', params: {} }
2023-08-25T20:53:31.900Z cypress-verbose:server:browsers:cri-client:recv:[<--] received CDP message { id: 7, result: {} }
2023-08-25T20:53:31.900Z cypress-verbose:server:browsers:cri-client:send:[-->] sending CDP command { id: 8, method: 'Page.navigate', params: { url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts' } }
2023-08-25T20:54:28.990Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43002 }
2023-08-25T20:54:29.030Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43016 }
2023-08-25T20:54:29.089Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42998 }
2023-08-25T20:54:29.461Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42994 }
2023-08-25T20:54:29.464Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 53212 }
2023-08-25T20:54:29.464Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42988 }

2023-08-25T20:54:31.882Z cypress:server:browsers killing browser process
2023-08-25T20:54:31.882Z cypress:server:browsers:chrome closing remote interface client
2023-08-25T20:54:31.883Z cypress:server:browsers:chrome closing chrome
2023-08-25T20:54:31.888Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 49610 }
2023-08-25T20:54:31.890Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44854 }
2023-08-25T20:54:31.891Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44882 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44802 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 43066 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 44866 }
2023-08-25T20:54:31.892Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 53074 }
2023-08-25T20:54:31.893Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 33994 }
2023-08-25T20:54:31.893Z cypress:server:socket-base socket-disconnecting transport close
2023-08-25T20:54:31.893Z cypress:server:socket-base socket-disconnect transport close
2023-08-25T20:54:31.913Z cypress:launcher:browsers chrome exited: { code: null, signal: 'SIGTERM' }
2023-08-25T20:54:31.930Z cypress:server:preprocessor removeFile /pokey/tests/frontend/editorial-pages/cypress/integration/experience-cards.test.ts
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter plugin close event
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter native close event
2023-08-25T20:54:31.930Z cypress:server:preprocessor base emitter native close event
2023-08-25T20:54:31.930Z cypress:server:browsers:chrome closing remote interface client
2023-08-25T20:54:31.930Z cypress:server:browsers browser process killed
2023-08-25T20:54:31.931Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/strip-ansi/index.js" (cache | exports) -> moduleCache: 902, exportsCache: 3761, loaded: 901
2023-08-25T20:54:31.932Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/errorUtils.ts" (cache | exports) -> moduleCache: 903, exportsCache: 3761, loaded: 902
2023-08-25T20:54:31.932Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/stripIndent.ts" (cache | exports) -> moduleCache: 904, exportsCache: 3761, loaded: 903
2023-08-25T20:54:31.933Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/chalk/index.js" (cache | exports) -> moduleCache: 904, exportsCache: 3761, loaded: 903
2023-08-25T20:54:31.933Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/errors/src/errTemplate.ts" (cache | definitions) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.934Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/lodash/lodash.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.935Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/lodash/lodash.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
Timed out waiting for the browser to connect. Retrying...
2023-08-25T20:54:31.936Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/node_modules/chalk/index.js" (cache | exports) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.936Z cypress:server:run waiting for socket to connect and browser to launch...
2023-08-25T20:54:31.936Z cypress:server:run waiting for socket connection... { id: '9n454ipst4' }
2023-08-25T20:54:31.936Z cypress:server:open_project resetting project state, preparing to launch browser chrome for spec { fileExtension: '.ts', baseName: 'sem-pages.test.ts', fileName: 'sem-pages', specFileExtension: '.test.ts', relativeToCommonRoot: 'sem-pages.test.ts', specType: 'integration', name: 'integration/sem-pages.test.ts', relative: 'integration/sem-pages.test.ts', absolute: '/pokey/tests/frontend/editorial-pages/cypress/integration/sem-pages.test.ts' } options { projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', shouldLaunchNewTab: true, onError: [Function (anonymous)], videoApi: { onError: [Function (anonymous)], videoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts.mp4', compressedVideoName: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos/sem-pages.test.ts-compressed.mp4', useFfmpegVideoController: [AsyncFunction: useFfmpegVideoController], useVideoController: [Function: useVideoController], onProjectCaptureVideoFrames: [Function: onProjectCaptureVideoFrames] }, automationMiddleware: { onBeforeRequest: [Function: onBeforeRequest], onAfterResponse: [Function: onAfterResponse] }, onWarning: [Function: onWarning] }
2023-08-25T20:54:31.936Z cypress:server:project resetting project instance /pokey/tests/frontend/editorial-pages/cypress
2023-08-25T20:54:31.936Z cypress:proxy:http:util:buffers resetting buffers
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states setting remote state { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states getting remote state: { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for: https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:server:project_utils returning spec url https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:open_project open project url https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:project project has config { baseUrl: 'https://www.[REDACTED].com', supportFile: '/pokey/tests/frontend/editorial-pages/cypress/support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [ '*google-analytics.com', '*googleadservices.com', '*googletagmanager.com', '*doubleclick.net', '*google.com', '*ampcid.google.com', '*facebook.com' ], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: '/pokey/tests/frontend/editorial-pages/cypress/fixtures', supportFolder: '/pokey/tests/frontend/editorial-pages/cypress/support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]', projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', projectName: 'cypress', repoRoot: '/pokey/tests/frontend/editorial-pages/cypress', rawJson: { e2e: { baseUrl: 'https://hyperloop.localhost.[REDACTED].com/', supportFile: 'support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [Array], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: 'fixtures', supportFolder: 'support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]' }, baseUrl: 'https://www.[REDACTED].com', supportFile: 'support/index.ts', specPattern: 'integration/**/*.test.ts', viewportWidth: 1400, viewportHeight: 1000, blockHosts: [ '*google-analytics.com', '*googleadservices.com', '*googletagmanager.com', '*doubleclick.net', '*google.com', '*ampcid.google.com', '*facebook.com' ], chromeWebSecurity: false, responseTimeout: 60000, defaultCommandTimeout: 8000, fixturesFolder: 'fixtures', supportFolder: 'support', retries: 3, testIsolation: false, pageLoadTimeout: 120000, userAgent: 'Cypress bot', experimentalRunAllSpecs: true, setupNodeEvents: '[Function ]', envFile: {}, projectRoot: '/pokey/tests/frontend/editorial-pages/cypress', projectName: 'cypress', repoRoot: '/pokey/tests/frontend/editorial-pages/cypress' }, configFile: 'cypress.config.js', morgan: false, isTextTerminal: true, socketId: '9n454ipst4', report: true, reporter: '/pokey/tests/frontend/cypress/script/pokeyReporter.js', video: true, videoCompression: false, animationDistanceThreshold: 5, arch: 'x64', clientCertificates: [], downloadsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/downloads', env: { UNIQUE_ID: '01H8Q6X8DR8V3CZM2WBYK0XWJH_1692996470222', KUBE_GEN_ENV: 'production', KUBE_GEN_PROJECT: 'seo-loop', JOB_NAME: 'cy-cron', LOG_PATH: '/pokey/tests/test-output.log', CACHE_FOLDER: '.cache/cypress', grepTags: '', secrets: { [REDACTED] } }, execTimeout: 60000, experimentalCspAllowList: false, experimentalFetchPolyfill: false, experimentalInteractiveRunEvents: false, experimentalMemoryManagement: false, experimentalModifyObstructiveThirdPartyCode: false, experimentalSkipDomainInjection: null, experimentalOriginDependencies: false, experimentalSourceRewriting: false, experimentalSingleTabRunMode: false, experimentalStudio: false, experimentalWebKitSupport: false, fileServerFolder: '/pokey/tests/frontend/editorial-pages/cypress', excludeSpecPattern: '*.hot-update.js', includeShadowDom: false, keystrokeDelay: 0, modifyObstructiveCode: true, nodeVersion: undefined, numTestsKeptInMemory: 0, platform: 'linux', port: 40607, projectId: null, redirectionLimit: 20, reporterOptions: null, requestTimeout: 5000, resolvedNodePath: '/usr/bin/node_real', resolvedNodeVersion: '16.20.0', screenshotOnRunFailure: true, screenshotsFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/screenshots', slowTestThreshold: 10000, scrollBehavior: 'top', taskTimeout: 60000, trashAssetsBeforeRuns: true, videosFolder: '/pokey/tests/frontend/editorial-pages/cypress/cypress/videos', videoUploadOnPasses: true, waitForAnimations: true, watchForFileChanges: false, additionalIgnorePattern: [], autoOpen: false, browsers: [ { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106' }, { name: 'electron', channel: 'stable', family: 'chromium', displayName: 'Electron', version: '106.0.5249.51', path: '', majorVersion: 106 } ], clientRoute: '/__/', cypressBinaryRoot: '/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app', devServerPublicPathRoute: '/__cypress/src', hosts: null, isInteractive: true, namespace: '__cypress', reporterRoute: '/__cypress/reporter', socketIoCookie: '__socket', socketIoRoute: '/__socket', version: '12.17.3', cypressEnv: 'production', resolved: { animationDistanceThreshold: { value: 5, from: 'default' }, arch: { value: 'x64', from: 'default' }, baseUrl: { value: 'https://www.[REDACTED].com', from: 'env' }, blockHosts: { value: [Array], from: 'config' }, chromeWebSecurity: { value: false, from: 'config' }, clientCertificates: { value: [], from: 'default' }, defaultCommandTimeout: { value: 8000, from: 'config' }, downloadsFolder: { value: 'cypress/downloads', from: 'default' }, env: { UNIQUE_ID: [Object], KUBE_GEN_ENV: [Object], KUBE_GEN_PROJECT: [Object], JOB_NAME: [Object], LOG_PATH: [Object], CACHE_FOLDER: [Object], grepTags: [Object], secrets: [Object] }, execTimeout: { value: 60000, from: 'default' }, experimentalCspAllowList: { value: false, from: 'default' }, experimentalFetchPolyfill: { value: false, from: 'default' }, experimentalInteractiveRunEvents: { value: false, from: 'default' }, experimentalRunAllSpecs: { value: true, from: 'config' }, experimentalMemoryManagement: { value: false, from: 'default' }, experimentalModifyObstructiveThirdPartyCode: { value: false, from: 'default' }, experimentalSkipDomainInjection: { value: null, from: 'default' }, experimentalOriginDependencies: { value: false, from: 'default' }, experimentalSourceRewriting: { value: false, from: 'default' }, experimentalSingleTabRunMode: { value: false, from: 'default' }, experimentalStudio: { value: false, from: 'default' }, experimentalWebKitSupport: { value: false, from: 'default' }, fileServerFolder: { value: '', from: 'default' }, fixturesFolder: { value: 'fixtures', from: 'config' }, excludeSpecPattern: { value: '*.hot-update.js', from: 'default' }, includeShadowDom: { value: false, from: 'default' }, keystrokeDelay: { value: 0, from: 'default' }, modifyObstructiveCode: { value: true, from: 'default' }, nodeVersion: { value: undefined, from: 'default' }, numTestsKeptInMemory: { value: 0, from: 'config' }, platform: { value: 'linux', from: 'default' }, pageLoadTimeout: { value: 120000, from: 'config' }, port: { value: null, from: 'default' }, projectId: { value: null, from: 'default' }, redirectionLimit: { value: 20, from: 'default' }, reporter: { value: '/pokey/tests/frontend/cypress/script/pokeyReporter.js', from: 'cli' }, reporterOptions: { value: null, from: 'default' }, requestTimeout: { value: 5000, from: 'default' }, resolvedNodePath: { value: null, from: 'default' }, resolvedNodeVersion: { value: null, from: 'default' }, responseTimeout: { value: 60000, from: 'config' }, retries: { value: 3, from: 'config' }, screenshotOnRunFailure: { value: true, from: 'default' }, screenshotsFolder: { value: 'cypress/screenshots', from: 'default' }, slowTestThreshold: { value: 10000, from: 'default' }, scrollBehavior: { value: 'top', from: 'default' }, supportFile: { value: 'support/index.ts', from: 'config' }, supportFolder: { value: 'support', from: 'config' }, taskTimeout: { value: 60000, from: 'default' }, testIsolation: { value: false, from: 'config' }, trashAssetsBeforeRuns: { value: true, from: 'default' }, userAgent: { value: 'Cypress bot', from: 'config' }, video: { value: true, from: 'cli' }, videoCompression: { value: false, from: 'cli' }, videosFolder: { value: 'cypress/videos', from: 'default' }, videoUploadOnPasses: { value: true, from: 'default' }, viewportHeight: { value: 1000, from: 'config' }, viewportWidth: { value: 1400, from: 'config' }, waitForAnimations: { value: true, from: 'default' }, watchForFileChanges: { value: false, from: 'config' }, specPattern: { value: 'integration/**/*.test.ts', from: 'config' }, browsers: { value: [Array], from: 'runtime' }, hosts: { value: null, from: 'default' }, isInteractive: { value: true, from: 'default' } }, testingType: 'e2e', remote: {}, browser: null, specs: [], proxyUrl: 'http://localhost:40607', browserUrl: 'https://www.[REDACTED].com/__/', reporterUrl: 'https://www.[REDACTED].com/__cypress/reporter', proxyServer: 'http://localhost:40607', state: {} }
2023-08-25T20:54:31.937Z cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: '[REDACTED]', tld: 'com' }
2023-08-25T20:54:31.937Z cypress:server:remote-states getting remote state: { auth: undefined, origin: 'https://www.[REDACTED].com', strategy: 'http', fileServer: null, domainName: '[REDACTED].com', props: { port: '443', protocol: 'https:', subdomain: 'www', domain: '[REDACTED]', tld: 'com' } } for: https://[REDACTED].com
2023-08-25T20:54:31.937Z cypress:server:open_project launching browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false }, spec: integration/sem-pages.test.ts
2023-08-25T20:54:31.937Z cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '106.0.5249.119', path: 'google-chrome', minSupportedVersion: 64, majorVersion: '106', isHeadless: true, isHeaded: false } }
2023-08-25T20:54:31.937Z cypress-verbose:packherd:trace Module._load "./chrome"
2023-08-25T20:54:31.938Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts" (module-fullpath:node | Module._cache) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.938Z cypress-verbose:packherd:trace Resolved "./chrome" via module-fullpath:node (packages/server/lib/browsers/chrome.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/browsers/chrome.ts)
2023-08-25T20:54:31.938Z cypress:server:browsers:chrome connecting to new chrome tab in existing instance with url and debugging port {
  url: 'https://www.[REDACTED].com/__/#/specs/runner?file=integration/sem-pages.test.ts'
}
2023-08-25T20:54:31.931Z cypress:webpack close /pokey/tests/frontend/editorial-pages/cypress/integration/experience-cards.test.ts
2023-08-25T20:54:31.940Z cypress:server:cypress exiting with err Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:4560:46243)
    at Object.connectToNewSpec (<embedded>:4560:25729)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async v.relaunchBrowser (<embedded>:4626:397035)
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Module._load "./errors"
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Loaded "/pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/errors.ts" (module-fullpath:node | Module._cache) -> moduleCache: 905, exportsCache: 3761, loaded: 904
2023-08-25T20:54:31.940Z cypress-verbose:packherd:trace Resolved "./errors" via module-fullpath:node (packages/server/lib/errors.ts | /pokey/tests/.cache/cypress/12.17.3/Cypress/resources/app/packages/server/lib/errors.ts)
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:4560:46243)
    at Object.connectToNewSpec (<embedded>:4560:25729)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async v.relaunchBrowser (<embedded>:4626:397035)

it's clear that cypress is killing the browser: cypress:server:browsers killing browser process, but not seeing any particular reason why, or how we can prevent it

@joshkaplan
Copy link
Author

updates:

  • we noticed that a test in the first spec was clicking on a link with target set to _blank, opening in a new tab.
  • removing this click() seems to have mitigated the issue
  • it is still happening sporadically on other projects, ~ .5% of the time

hopefully that can maybe help narrow in what might be going on.

some outstanding questions:

  • is this expected behavior for new tabs?
    • if so, it ought to (1) fail more loudly and more explicitly, (2) be documented, and (3) ideally there would be a way to globally handle this
    • if not, what's going on here?
  • why might it be happening sporadically?

@stfnzl
Copy link

stfnzl commented Sep 2, 2023

Experiencing this issue as well.

Setup:

In another project this issue does not exists. Same pipeline setup but:

  • Cypress 12.8.1
  • No Cypress Cloud
  • Chrome 99

Would any of the following help?

  • Upgrade Chrome
  • No docker, run raw on the vm

@stfnzl
Copy link

stfnzl commented Sep 2, 2023

Quick update from my side:

  • Updated chrome
  • No docker, run raw on the VM
  • Gave the VM more RAM

Do not see any issue anymore...

@Dospios
Copy link

Dospios commented Oct 5, 2023

I have the same problem.

  • Cypress v13.2.0
  • Chrome v117
  • No cypress cloud.
  • Run tests via LXC

There is no stable 100% STR, the problem is only on CI, in about 10-20% of cases.

After RAM was increased, the problem began to appear a little less often, but it did not disappear completely.

I hope you solve this problem or tell a workaround, this problem makes our ci tests unstable

@Dospios
Copy link

Dospios commented Oct 19, 2023

Any update?

@stfnzl
Copy link

stfnzl commented Oct 21, 2023

@Dospios I did some experimenting and it seems like that setting

export NODE_OPTIONS=--max_old_space_size=8192

did help a lot.

I also set numTestsKeptInMemory: 1 in cypress.config.js but max_old_space_size is something you want to try.

@Dospios
Copy link

Dospios commented Oct 21, 2023

@stfnzl
I already set max_old_space_size=8192 in NODE_OPTIONS when starting cypress and in js-flags in arguments when starting chrome.
numTestsKeptInMemory: 0
I also clear the memory after every third test using Cypress.automation('remote:debugger:protocol', { command: 'HeapProfiler.collectGarbage' }). The maximum memory consumption at the time of the crash does not exceed 3gb.
None of this helped, unfortunately.
Also, sometimes before the error Missing browserCriClient in connectToNewSpec another one began to appear - cypress:launcher:browsers chrome stderr: [1020/143746.177548:WARNING:sqlite_persistent_store_backend_base.cc(198)] Failed to post task from FlushAndNotifyInBackground@net/extras/sqlite/sqlite_persistent _store_backend_base.cc :246 to client_task_runner_.

@stfnzl
Copy link

stfnzl commented Oct 22, 2023

@Dospios just for curiosity, do you run cypress and the web server in the same host?
Meaning do you run cypress against http://localhost or against an external url?

@Dospios
Copy link

Dospios commented Oct 22, 2023

@stfnzl external url. For each PR, a test stand is deployed, on which autotests are run and manual testing is carried out

@stfnzl
Copy link

stfnzl commented Oct 23, 2023

@Dospios thanks for the info. I asked 'cause we run against localhost and wanted to check if separating cypress/chrome and the webserver would have helped, but it is not the case seems like so not gonna spend time on setting it up.

I did a "stress test" on our setup by running 20 builds in azure devops which trigger 3 parallelized jobs each (~60 cypress runs)
and I got 2 Missing browserCriClient in connectToNewSpec, the remaining are green.

3.3% failure rate is still too high imo... my goal is to have at least 100 consecutive stable runs (<1% failure rate)

...and the fact that cypress cloud will not report it as failure but rather as a timeout does not help either 😞

@abinaya-konda
Copy link

any update on this? I keep getting this issue consistently while executing the last test on the CI/CD pipeline and nothing seems to fix this. It makes the test unusable!

Timed out waiting for the browser to connect. Retrying...
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
at Object.connectToNewSpec (:4496:47084)
at Object.connectToNewSpec (:4496:26109)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async v.relaunchBrowser (:4562:36202)
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results

Cypress v13.3.0
No cypress cloud.
Run tests via github actions

@stfnzl
Copy link

stfnzl commented Nov 14, 2023

We have different projects running Cypress without any issues, but the only one that is failing with
Error: Missing browserCriClient in connectToNewSpec has the most tests (~250)

Do you experience the same @abinaya-konda @Dospios?

I'm thinking to split the tests in 3 or 4 groups and see if it helps or not...

@Dospios
Copy link

Dospios commented Nov 14, 2023

@stfnzl Also have 200+ isolated tests that run in parallel. But I noticed that the browser can crash even on 1-5 specs at the very beginning of the run.
I wrote a crutch that allows you to automatically retrain the job to ci if browserCriClient is present in stdout, starting the job again in this case, but this is just a crutch, not a solution to the problem

@abinaya-konda
Copy link

@stfnzl - I have around 150 tests running, and it always seems to fail at the last spec file. If I skip or remove it, the issue pops up at the new last spec file. Now this happens around 80% of the tests that I have removed cypress test suite from the pipeline for now!

@jazpearson
Copy link

jazpearson commented Jan 11, 2024

One thing that i did was to switch to using Edge as the browser. I've barely seen this issue since, whereas before the switch, we were seeing something like 30-40% of test runs fail.

@timollet
Copy link

Hey,
I have the same issue :

  • using docker on CI/CD
  • less than 10 tests
  • cypress version 12.17.2
  • resource setting :
    requests:
    cpu: 2000m
    memory: 4G
    limits:
    cpu: 4000m
    memory: 8G
  • Chrome: v114
  • node : v18.16.0
  • 100% failed
  • 0% failed in local

Timed out waiting for the browser to connect. Retrying...
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
at Object.connectToNewSpec (:4580:46243)
at Object.connectToNewSpec (:4580:25729)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async v.relaunchBrowser (:4646:397035)

Has anyone found a solution?

@polina-anisova
Copy link

Experiencing this with Cypress 13.6.0, running tests in Github Actions in docker

@SerdarNur
Copy link

Are here any updates or solutions? @jennifer-shehane @mschile @AtofStryker

@jennifer-shehane
Copy link
Member

We have gotten some DEBUG logs with more specifics that we're looking into. It looks like this error started around 11.0 in Cypress, but is maybe happening more frequently lately due to some other change.

@AtofStryker
Copy link
Contributor

OK I am able to reproduce this. Its similar to #28397. The logs provided suggest that the browser is exiting mid run (I don't want to say crash because the exit code is 0). When that happens, we wait for the browser to reconnect up to 3 attempts. In this case though, since the browser closed, we closed the CRI client as well and we are able to successfully relaunch the browser, expecting the CRI client to be there, but its not so we get this error. I can reproduce it with this branch against this test suite. I will start exploring solutions shortly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reproducible Can be reproduced stage: needs investigating Someone from Cypress needs to look at this type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants