cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.43k stars 3.14k forks source link

XDG_RUNTIME_DIR error in Debian 12.x headless #29554

Open MikeMcC399 opened 1 month ago

MikeMcC399 commented 1 month ago

Current behavior

Running Cypress default scaffolded tests on Debian 12.5 in a headless environment (server with no GPU) may result in the error:

error: XDG_RUNTIME_DIR is invalid or not set in the environment

It may occur with Electron, Chrome, Edge for Firefox browsers and may be associated with a test failure or not. For example

  Running:  2-advanced-examples/files.cy.js                                                (8 of 20)
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.

Timed out waiting for the browser to connect. Retrying...
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:4413:48840)
    at Object.connectToNewSpec (<embedded>:4413:27125)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async v.relaunchBrowser (<embedded>:4498:37708)

Desired behavior

Cypress should run the default scaffolded tests reliably under Debian 12.5 on a server with no GPU.

The issue is not reproducible on Debian 12.5 where a GPU (graphics processing unit) is installed.

Test code to reproduce

Cypress Version

First reported on 13.10.0 Also reproducible on 13.13.0

Node version

v20.13.1 v20.14.0

Operating System

Debian 12.5 12.6

Debug Logs

See https://app.circleci.com/pipelines/github/cypress-io/cypress-docker-images

Other

Related

estefafdez commented 1 month ago

any update on this error? thanks!

MikeMcC399 commented 1 month ago

@estefafdez

any update on this error? thanks!

Are you also seeing this error or are you just interested in the outcome?

estefafdez commented 1 month ago

@estefafdez

any update on this error? thanks!

Are you also seeing this error or are you just interested in the outcome?

I'm seeing the error on the logs at the moment with the latest version of cypress (13.10.0)

MikeMcC399 commented 1 month ago

@estefafdez

I'm seeing the error on the logs at the moment with the latest version of cypress (13.10.0)

Are you also running under Debian 12.5 or is it a different environment? Could you also explain whether this is in a local system or a CI system and if it's CI please give some details about the provider and the exact runner type. Also if you are running in Docker or not. All details will be helpful.

MikeMcC399 commented 1 month ago

The error XDG_RUNTIME_DIR may be another garbage error resulting from Electron.

The fact that it is sometimes occurs with a test failure may or may not be coincidence.

maximegheraille commented 1 month ago

Hi, we are also experiencing the same on issue on version 13.10.0 of cypress when a test is failing.

We run our test in a docker container that uses cypress/factory.

Tried with version 13.8.1 and the issue is also present

MikeMcC399 commented 1 month ago

@maximegheraille

Which version of cypress/factory are you basing your Docker container on?

What output does the following command yield?

docker run --entrypoint cat <your Docker image> /etc/debian_version
maximegheraille commented 1 month ago

Hi @MikeMcC399

We use the latest version cypress/factory:latest and the debian version is 12.5

MikeMcC399 commented 1 month ago

@maximegheraille

If the failures are repeatable, then you may like to try with DEBUG=cypress:* to see if there are any other relatable errors.

In the test runs of the Docker repo https://github.com/cypress-io/cypress-docker-images I am seeing the error happening quite often, but without test failure:

error: XDG_RUNTIME_DIR

maximegheraille commented 1 month ago

Hi @MikeMcC399

I did investigate a few non failing runs, and it is also showing it. This means that it is not related to failing test.

I will try with the debug option and see if I can find anything useful

EtienneBruines commented 3 weeks ago

Also experiencing this issue (but with the cypress/browsers:latest docker image).

@MikeMcC399 Here are the logs surrounding the XDG_RUNTIME_DIR error. After the error, it only repeats the memory/cpu usage periodically, basically 'hanging' and not running any tests.

Difference with me: It's reproducible 100% of the time.


  │ Cypress:        13.11.0                                                                        │
  │ Browser:        Chrome 124 (headless)                                                          │
  │ Node Version:   v22.0.0 (/usr/local/bin/node)                                                  │
  cypress:https-proxy received error on client browserSocket { err: Error: write EPIPE     at afterWriteDispatched (node:internal/stream_base_commons:160:15)     at writeGeneric (node:internal/stream_base_commons:151:3)     at Socket._writeGeneric (node:net:931:11)     at Socket._write (node:net:943:8)     at writeOrBuffer (node:internal/streams/writable:392:12)     at _write (node:internal/streams/writable:333:10)     at Socket.write (node:internal/streams/writable:337:10)     at Socket.ondata (node:internal/streams/readable:766:22)     at Socket.emit (node:events:514:28)     at addChunk (node:internal/streams/readable:324:12)     at readableAddChunk (node:internal/streams/readable:297:9)     at Socket.push (node:internal/streams/readable:234:10)     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { errno: -32, code: 'EPIPE', syscall: 'write' }, url: 'optimizationguide-pa.googleapis.com:443' } +2s
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 50262 } +299ms
  cypress:server:request received an error on request after response started { browserPreRequest: undefined, timeout: undefined, retryIntervals: [], url: '[https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION'](https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION%27), time: false, requestId: 'request150', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: aborted     at connResetException (node:internal/errors:720:14)     at TLSSocket.socketCloseListener (node:_http_client:461:19)     at TLSSocket.emit (node:events:526:35)     at node:net:323:12     at TCP.done (node:_tls_wrap:588:7) { code: 'ECONNRESET' } } +1ms
  cypress:proxy:http:util:prerequests Never received pre-request or url without pre-request for request GET-https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION after waiting 2000ms. Continuing without one. +61ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +40ms
  cypress:server:util:resource-type-and-credential credentials request received for request url https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION, hashKey 57d076d8888ceb613df46a85d1778a12 +61ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +1ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:server:remote-states getting remote state: undefined for: https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION +41ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +0ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +0ms
  cypress:server:stream_buffer stream buffer writeable final called +61ms
  cypress:network:agent addRequest called { isHttps: true, href: '[https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION'](https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION%27) } +61ms
  cypress:network:agent got family { family: 4, href: '[https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION'](https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION%27) } +0ms
  cypress:server:request received status code & headers on request { requestId: 'request151', statusCode: 200, headers: { 'content-type': 'text/html; charset=UTF-8' } } +39ms
  cypress:server:request successful response received { requestId: 'request151' } +1ms
  cypress:net-stubbing:server:intercept-response InterceptResponse { req: { url: '/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION' }, request: undefined } +46ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +3ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +3ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:server:remote-states getting primary remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +1ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +0ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +1ms
  cypress:https-proxy received error on client browserSocket { err: Error: read ECONNRESET     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) { errno: -104, code: 'ECONNRESET', syscall: 'read' }, url: 'optimizationguide-pa.googleapis.com:443' } +43ms
  cypress:server:request received status code & headers on request { requestId: 'request152', statusCode: 200, headers: { 'content-type': 'text/html; charset=UTF-8' } } +54ms
  cypress:server:request successful response received { requestId: 'request152' } +0ms
  cypress:net-stubbing:server:intercept-response InterceptResponse { req: { url: '/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION' }, request: undefined } +54ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +54ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +54ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:server:remote-states getting primary remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'optimizationguide-pa', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +0ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +0ms
  cypress:https-proxy received error on client browserSocket { err: Error: write EPIPE     at afterWriteDispatched (node:internal/stream_base_commons:160:15)     at writeGeneric (node:internal/stream_base_commons:151:3)     at Socket._writeGeneric (node:net:931:11)     at Socket._write (node:net:943:8)     at writeOrBuffer (node:internal/streams/writable:392:12)     at _write (node:internal/streams/writable:333:10)     at Socket.write (node:internal/streams/writable:337:10)     at Socket.ondata (node:internal/streams/readable:766:22)     at Socket.emit (node:events:514:28)     at addChunk (node:internal/streams/readable:324:12)     at readableAddChunk (node:internal/streams/readable:297:9)     at Socket.push (node:internal/streams/readable:234:10)     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { errno: -32, code: 'EPIPE', syscall: 'write' }, url: 'optimizationguide-pa.googleapis.com:443' } +56ms
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 50274 } +99ms
  cypress:server:request aborting { requestId: 'request152' } +5ms
  cypress:server:request aborting { requestId: 'request152' } +0ms
  cypress:server:request received an error on request after response started { browserPreRequest: undefined, timeout: undefined, retryIntervals: [], url: '[https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION'](https://optimizationguide-pa.googleapis.com/downloads?name=1689043206&target=OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION%27), time: false, requestId: 'request152', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: aborted     at connResetException (node:internal/errors:720:14)     at TLSSocket.socketCloseListener (node:_http_client:461:19)     at TLSSocket.emit (node:events:526:35)     at node:net:323:12     at TCP.done (node:_tls_wrap:588:7) { code: 'ECONNRESET' } } +1ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.6     │      11.8      │  882.63  │    890.72    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    2.58    │     10.16      │  474.3   │    450.31    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  245.65  │    294.84    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │    0.85    │      1.56      │  126.32  │    130.73    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1503, 1504'                      │     50     │      62.5      │   5.2    │    41.91     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │   56.03    │     79.73      │  1734.1  │   1350.59    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 50250 } +5s
  cypress:server:server-base Got CONNECT request from safebrowsingohttpgateway.googleapis.com:443 +12s
  cypress:https-proxy Writing browserSocket connection headers { url: 'safebrowsingohttpgateway.googleapis.com:443', headLength: 0, headers: { host: 'safebrowsingohttpgateway.googleapis.com:443', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/125.0.0.0 Safari/537.36' } } +10s
  cypress:https-proxy Got first head bytes { url: 'safebrowsingohttpgateway.googleapis.com:443', head: '\x16\x03\x01\x070\x01\x00\x07,\x03\x03IU[_\x07�f\x1E��Ѫ��Q��G싏��^��+��\x06\x1A9 Yb�$�\x06���Gd��Fd\\�\x15U�d�\f' } +0ms
  cypress:https-proxy Making intercepted connection to 41673 +54ms
  cypress:network:connect successfully connected { opts: { port: 41673, host: 'localhost', getDelayMsForRetry: [Function: h] }, iteration: 0 } +12s
  cypress:https-proxy received upstreamSocket callback for request { port: 41673, hostname: 'localhost', err: undefined } +2ms
  cypress:server:util:socket_allowed allowing socket { localPort: 33752 } +5s
  cypress:launcher:browsers chrome stderr: [1215:1233:0611/105732.491350:ERROR:cert_verify_proc_builtin.cc(1051)] CertVerifyProcBuiltin for safebrowsingohttpgateway.googleapis.com failed:
----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=safebrowsingohttpgateway.googleapis.com) -----
ERROR: No matching issuer found +22s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.46    │      8.69      │  876.91  │    886.11    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.35    │      8.2       │  449.23  │    450.09    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    285.32    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      1.17      │  126.32  │    129.63    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1539, 1540'                      │     50     │       60       │   5.18   │    34.56     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │    52.8    │     74.35      │ 1704.88  │   1421.45    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:proxy:http:util:prerequests Never received pre-request or url without pre-request for request GET-https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw after waiting 2000ms. Continuing without one. +12s
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +12s
  cypress:server:util:resource-type-and-credential credentials request received for request url https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw, hashKey 3dd49b057297dc81ebe26a7a54700525 +12s
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'secure8', domain: 'datev', tld: 'de' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +1ms
  cypress:server:remote-states getting remote state: undefined for: https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw +12s
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +0ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +0ms
  cypress:server:stream_buffer stream buffer writeable final called +12s
  cypress:network:agent addRequest called { isHttps: true, href: '[https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw'](https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw%27) } +12s
  cypress:network:connect beginning getAddress { hostname: 'safebrowsingohttpgateway.googleapis.com', port: 443 } +2s
  cypress:network:connect got addresses { hostname: 'safebrowsingohttpgateway.googleapis.com', port: 443, addresses: [ { address: '142.250.181.202', family: 4 }, { address: '172.217.16.74', family: 4 }, { address: '142.251.209.138', family: 4 }, { address: '172.217.19.74', family: 4 }, { address: '2a00:1450:4005:801::200a', family: 6 }, { address: '2a00:1450:4005:80b::200a', family: 6 }, { address: '2a00:1450:4005:802::200a', family: 6 } ] } +33ms
  cypress:network:agent got family { family: 4, href: '[https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw'](https://safebrowsingohttpgateway.googleapis.com/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw%27) } +37ms
  cypress:server:request received status code & headers on request { requestId: 'request153', statusCode: 200, headers: { 'content-type': 'application/ohttp-keys' } } +12s
  cypress:server:request successful response received { requestId: 'request153' } +0ms
  cypress:net-stubbing:server:intercept-response InterceptResponse { req: { url: '/v1/ohttp/hpkekeyconfig?key=AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw' }, request: undefined } +12s
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +68ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +68ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:server:remote-states getting primary remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'safebrowsingohttpgateway', tld: 'googleapis.com' } +0ms
  cypress:network:cors Parsed URL { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } +1ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'http://localhost'/, strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '80', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost/ +1ms
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 33752 } +7s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.84    │      7.22      │  831.93  │    872.57    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    1.37    │      7.06      │  437.47  │    447.99    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    278.97    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.94      │  126.32  │    128.97    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1575, 1576'                      │     0      │       50       │   5.19   │    29.67     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │    4.21    │     62.66      │ 1648.15  │   1459.23    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.2     │      6.22      │  837.3   │    865.51    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.2     │      6.08      │  438.21  │    446.59    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    274.43    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.78      │  126.32  │    128.53    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1611, 1612'                      │    100     │     57.14      │   5.13   │    26.16     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │   102.4    │     68.34      │  1654.2  │   1487.09    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.51    │      5.6       │  838.23  │    860.97    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.2     │      5.35      │  437.87  │    445.5     │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    271.03    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.67      │  126.32  │    128.21    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1647, 1648'                      │     0      │       50       │   5.24   │    23.55     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │    2.71    │     60.13      │  1654.9  │   1508.06    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    6.09    │      5.67      │  792.82  │    851.23    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.17    │      4.77      │  437.9   │    444.66    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    268.39    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.59      │  126.32  │    127.98    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1683, 1684'                      │     0      │     44.44      │   5.21   │    21.51     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │    6.27    │     54.15      │ 1609.49  │   1519.33    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    1.88    │      5.2       │  775.97  │    841.82    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.17    │      4.31      │   438    │    443.99    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │     0      │       0        │  247.23  │    266.27    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.52      │  126.32  │    127.79    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1720, 1721'                      │     0      │       40       │   5.21   │    19.88     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │    2.05    │     48.94      │ 1592.74  │   1526.67    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────────────┬──────────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │       group       │ processCount │                         pids                          │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────────────┼──────────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │     'Chrome'      │      9       │ '1215, 1219, 1220, 1229, 1248, 1230 ... 3 more items' │    2.46    │      4.89      │  776.21  │    834.53    │    898.8    │
  cypress:server:util:process_profiler │    1    │     'cypress'     │      1       │                         '906'                         │    0.22    │      3.94      │  438.96  │    443.53    │   508.84    │
  cypress:server:util:process_profiler │    2    │ 'electron-shared' │      4       │                '910, 1062, 911, 1068'                 │    0.12    │      0.01      │  248.74  │    264.68    │   591.35    │
  cypress:server:util:process_profiler │    3    │     'plugin'      │      1       │                        '1112'                         │     0      │      0.47      │  126.32  │    127.64    │   169.17    │
  cypress:server:util:process_profiler │    4    │      'other'      │      2       │                     '1756, 1757'                      │     50     │     40.91      │   5.26   │    18.55     │   152.41    │
  cypress:server:util:process_profiler │    5    │      'TOTAL'      │      17      │                          '-'                          │   52.81    │     49.29      │  1595.5  │   1532.93    │   1779.67   │
  cypress:server:util:process_profiler └─────────┴───────────────────┴──────────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +10s
MikeMcC399 commented 3 weeks ago

@EtienneBruines

I suspect that these are two different errors. This is however just "gut feel". It needs more investigation to find out.

AndyClifford commented 2 weeks ago

Hey is there any update on this issue? Cheers !

MikeMcC399 commented 2 weeks ago

The https://github.com/cypress-io/cypress/labels/browser%3A%20chromium label can be removed, as this issue also occurs with Electron.

See https://app.circleci.com/pipelines/github/cypress-io/cypress-docker-images/2035/workflows/0b0791df-55ea-4811-a494-1111e289d282/jobs/61974

craigmiller160 commented 2 weeks ago

I can also say that I am seeing this reliably with certain tests in my GitLab CI pipeline using cypress/included:13.11.0. It's using chrome 125.

pitgrap commented 1 week ago

We see the error error: XDG_RUNTIME_DIR is invalid or not set in the environment. in our pipelines too. We use the docker image cypress/factory with

NODE_VERSION=20.14.0
CHROME_VERSION=118.0.5993.70-1
jimmigit commented 1 week ago

Also seeing this issue.

error: XDG_RUNTIME_DIR is invalid or not set in the environment.

Running: Cypress: 13.12.0
Browser: Chrome 126 (headless) │ Node Version: v20.14.0

serhatgemici commented 6 days ago

Having the same issue on Azure Pipelines: Docker Image: cypress/base:latest Cypress version: 13.12.0 Browser: Chrome 126 (headless)
Node Version: v20.14.0

 Running:  Tests.spec.js                                                        (1 of 5)
  Tests
    (Attempt 1 of 3) test one
    (Attempt 2 of 3) test one
    1) test one
    (Attempt 1 of 3) test two
    (Attempt 2 of 3) test two
    2) test two
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
    (Attempt 1 of 3) test three
    (Attempt 2 of 3) test three
    3) test three

  0 passing (2m)
  3 failing
...
...
...
##[error]error: XDG_RUNTIME_DIR is invalid or not set in the environment.
##[error]error: XDG_RUNTIME_DIR is invalid or not set in the environment.
##[error]The process '/usr/bin/docker' failed with exit code 7
Finishing: Start Container

Dockerfile

# Use the cypress/base image as the base
FROM cypress/base:latest AS base

ARG environment_group_arg
ENV ENV_GROUP_ARG=$environment_group_arg
ARG CYPRESS_TESTRAIL_PASSWORD
ENV CYPRESS_TESTRAIL_PASSWORD=$CYPRESS_TESTRAIL_PASSWORD

# Install necessary dependencies
RUN apt-get update
RUN apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libu2f-udev libvulkan1
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get -y install fonts-liberation xdg-utils man-db
RUN dpkg -i google-chrome-stable_current_amd64.deb

# Copy your application's files into the container
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci && npm cache clean --force
COPY . .

# Copy the entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Specify the entrypoint script
ENTRYPOINT ["/entrypoint.sh"]

RUN echo "Environment group: ${environment_group_arg} is built. {Legend:[1: Dev, 2: Stage, 3: Prod, 4: feature environment 5: feature env. in ci] }"
MikeMcC399 commented 6 days ago

@serhatgemici

It's difficult to know if Cypress failures are related to the XDG_RUNTIME_DIR or not.

Just as a comment on the way you are building your Docker image: you might find it easier to use cypress/factory which already adds the Linux prerequisites for Cypress and makes it easy to just add a selected version of Chrome. This comment is however off-topic for the current issue 🙂 If you want to discuss, then Discord chat (click on button) is a better place.