cypress-docker-images icon indicating copy to clipboard operation
cypress-docker-images copied to clipboard

Bump default SHM size?

Open cbrunnkvist opened this issue 4 years ago • 2 comments

https://github.com/cypress-io/cypress-docker-images/blob/3e022af0edde7941576a336e16ad1fe166a9fed3/generate-base-image.js#L121

I think we can add

Relevant documentation: https://docs.docker.com/engine/reference/commandline/image_build/#options

# docker --help
...
      --shm-size bytes          Size of /dev/shm

It can be overridden at run time but it can also have a default burnt into the image at build time.

Bumping it from its default 64M to something more reasonable may or may not help solve a number of OOM issues reported across this (#271) and the main repo (cypress-io/cypress/issues/350), or at least lower the frequency of these errors.

cbrunnkvist avatar May 20 '20 06:05 cbrunnkvist

With cypress/included:5.6.0 (and earlier versions), Chrome was crashing "Aw snap" with sigabrt after just a few page loads. Not even one test was able to complete.

Since it took my some time to identify this issue and understand the solution, I'm providing some information for other users who come across this report.

The way I confirmed the issue was to open a shell in the container. I'm using docker-compose, so my command was docker-compose exec cypress bash. Inside the shell I ran watch -n 1 'df -h |grep shm' to monitor shared memory usage during my attempted test. I saw it climb up to 95% - then chrome crashed.

I added this line to my docker-compose.yml file for the cypress service:

   shm_size: 512M

This allowed my test to complete easily.

jasonhildebrand avatar Nov 21 '20 05:11 jasonhildebrand

We suspect that increasing the SHM would also help us. We have a test that takes nearly 5 minutes to run, and we are unable to upgrade to the latest node18 container because the test never exits.

This is the debug output which keeps looping

[2022-09-21T16:13:06.114Z] 2022-09-21T16:13:04.521Z cypress:server:util:process_profiler current & mean memory and CPU usage by process group:

[2022-09-21T16:13:06.114Z] ┌─────────┬───────────────────┬──────────────┬─────────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐

[2022-09-21T16:13:06.115Z] │ (index) │       group       │ processCount │                            pids                             │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │

[2022-09-21T16:13:06.115Z] ├─────────┼───────────────────┼──────────────┼─────────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤

[2022-09-21T16:13:06.115Z] │    0    │     'Chrome'      │      7       │ '15132, 15137, 15138, 15149, 15171, 15150 ... 1 more items' │     0      │      0.12      │  379.98  │    416.19    │   3001.23   │

[2022-09-21T16:13:06.115Z] │    1    │     'cypress'     │      1       │                           '2735'                            │    0.17    │      0.18      │  307.24  │    306.11    │    336.6    │

[2022-09-21T16:13:06.115Z] │    2    │     'plugin'      │      1       │                           '3994'                            │     0      │       0        │  194.88  │    195.27    │   345.95    │

[2022-09-21T16:13:06.115Z] │    3    │ 'electron-shared' │      4       │                  '2773, 3558, 2774, 3757'                   │     0      │       0        │  190.34  │    190.23    │   190.34    │

[2022-09-21T16:13:06.115Z] │    4    │      'other'      │      2       │                       '27220, 27221'                        │     0      │       0        │   3.53   │     3.51     │    3.64     │

[2022-09-21T16:13:06.115Z] │    5    │      'TOTAL'      │      15      │                             '-'                             │    0.17    │      0.3       │ 1075.96  │   1110.68    │   3723.72   │

[2022-09-21T16:13:06.115Z] └─────────┴───────────────────┴──────────────┴─────────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘

cesine avatar Sep 21 '22 16:09 cesine

We can close this issue, it seem that we've resolved shm usage in another way.

In 7.0.1, Cypress passes disable-dev-shm-usage to Chrome and Electron on startup, which should remove the need to use --ipc=host or increase the /dev/shm size. Once it's released this should be solved.

see this comment: https://github.com/cypress-io/cypress/issues/350#issuecomment-814959972

mjhenkes avatar Jan 18 '23 18:01 mjhenkes