I am having issues understanding how CircleCI is allocating shared memory and how to configure it.
At the moment, I am using the latest selenium/standalone-firefox image. Locally, I have to set the shared memory size as 2GB in the docker run command.
On CircleCI, I have to set a resource_class of xlarge which is ridiculous since this has 16GB memory configuration.
Is there documentation on the current configuration of shared memory between containers? Is there a way to configure it? Or does anyone have any tips for this particular problem – maybe there is some JAVA_OPT I have to set?
EDIT: If I cannot specify --shm-size=2g then can I specify -v /dev/shm:/dev/shm?
In general, since this is running on a shared host that is running many docker containers there are sometimes issues because processes think that they have more memory than they really do.
For example. By default all builds have 4GB of RAM that need to be shared with every process of the build. However, if you use a program like free -m the memory that will be reported is the memory of the underlying host. So, this can create some issues if your test runner or configuration is trying to “infer” how much memory it has based on the host.
After a bit of tinkering, I do not think it’s a JAVA_OPTs thing. While the Selenium server runs in the JVM, the Firefox browser does its own thing. I bumped up the heap memory sizes but nothing changed.
I am starting to feel like it is an internal CircleCI bug. I’ll try to report this.
For those in the same boat as me, I am now starting to change to the Chrome browser. It seems like it does a better job at not crashing due to insufficient shared memory – but my suite is not 100% yet.