-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[2.15.0] - Ember build out of memory errors while using CI tools #15641
Comments
It does appear that there are some people who do have karma tests working with this step: https://discuss.circleci.com/t/running-browser-tests/10998/9 |
After the last few hours, I haven't been able to get this to work successfully yet, but i'm pretty confident this isn't specifically ember.js.... Closing for now. |
I'm having this same issue and have been unable to resolve. |
I chatted with @mwisner and @kiwiupover a bit about this over the weekend and we figured out that it has to do with the new parallelism that was added to broccoli-babel-transpiler. It defaults to paralellizing to the number of CPU's currently present. Unfortunately, on CircleCI this shows as 36 CPU's but the job itself is limited to 2 concurrent processes (and also limited in available RAM). The fix here is to set the JOBS environment variable to 1 to essentially disable the parallelism on CI. |
@rwjblue thanks for the context here! Even with Circle's parallelism, I would think (because they're split off into containers) that the
...I'm assuming that you mean to disable the broccoli-babel-transpiler parallelism and not Circle's containerized parallelism. Is that right? @eric-hu does this also seem like a correct reading to you? Is this something we should expect a fix from Circle on so that the CPUs actually available in the job are shown? Does this prevent any sort of parallelism on Circle's side (by splitting tests with something like |
I'm not sure if we can expect a fix form circleci themselves... I am not super 100% but I think it's more of a Docker problem than a circle problem specifically. Or maybe a Node + Docker issue not being able to accurately detect the cpu/mem limitations imposed by the docker container. I have created this repo for experimentation purposes: https://github.com/mwisner/ember-circleci-example. It includes circleci 2.0 (working w/ the JOBS=1 workaround provided by @rwjblue) (https://github.com/mwisner/ember-circleci-example/blob/master/.circleci/config.yml) Along with the public circle builds: https://circleci.com/gh/mwisner/ember-circleci-example/83 However I've also added the repo to travis ci, which also uses Docker for builds, I haven't fixed the travis config file yet but you can see the travis builds are failing with the provided travis config (https://travis-ci.org/mwisner/ember-circleci-example/builds) |
Thanks @mwisner. Was I correct in thinking that the |
@joshsmith Yeah if I understand correctly it's to disable parallelism within broccoli-babel-transpiler. Not circle itself. So in theory using circleci parallelism + jobs=1 would be fine? But personally, I haven't experimented with using circleci's parallelism functionality. So I'm not 100% sure what a configuration file for that would look like. |
Makes sense! I wanted to be sure I was just drawing a clear line between what seemed like two distinct uses of "parallelism" here, so I think I'm finally on the same page. I noticed you were setting |
It's also not specific to testing. The OOM issue is caused during the build phase of ember test. I've tested just running @joshsmith I do believe setting JOBS=1 at the env var level would work as well but I haven't confirmed. I noticed there is a pattern for setting env vars for ember cli commands for a few addons: https://github.com/ember-cli/broccoli-viz#usage So I was just going off of those usage patterns. |
Without knowing anything about how |
I just ran into this same issue on CircleCI, and |
@joshsmith there's two concepts of parallelism to keep in mind for CircleCI 2.0: A. Per-command parallelism, limited to the number of cores available to a container group. By default, each container group is allocated 2 CPU shares, which guarantees they get 2 CPU cores. There's a premium Configurable Resources feature that lets you choose a larger/smaller share (1, 4, 8 off the top of my head). B. CircleCI parallelism, which you can think of as "how many machines [1] do I want to split this across?". This is useful for test isolation, when you might want to run 2 tests at the same time and both write to a database. This is less useful for, say, transpiling your assets ; you probably want all your tests to run with the transpiled assets. Regarding A: since you have 2 cores guaranteed available by default, you may be able to run the command you want with JOBS=2. This may speed up execution, but I haven't checked if it works. Regarding B: even with JOBS=1, you can still use CircleCI parallelism to speed up your test suite. Regarding "who should fix this", I've seen this as a long-running issue with multiple containerization tools. The CircleCI 2.0 and 1.0 containerization tools --Docker and LXC respectively-- leak information about the host system for many common Linux commands, like the ones used to check how many cores are available. It's been this way for a number of years, I think if there were a simple fix it would have been solved by now. Further complicating things, CircleCI changed the CPU core availability model from 1.0 to 2.0. In 1.0, you got a fixed number of cores for a job. In 2.0, you get assigned CPU shares to guarantee your minimum number of cores. If you're on a fully utilized host, you'll get at least that many cores. If you're running on an under-utilized host, you'll have more cores available to you. Tools like [1] Your code may not be running on N machines for N parallelism. But you can think of it this way, as they're effectively isolated from one another. |
Just tried No noticeable time difference between those values in my small sample FWIW. |
@rwjblue I know you recommended having this issue in the ember-cli repo. However I opened this issue up when I first discovered the issue and looks like it was found before I could open up another in the ember-cli repo... Would you like me to open up another issue there and just reference this conversation? Know of anyway to easily move it? |
I reopened this issue because after doing some additional testing the provided travisci.yml config that ships with ember is also running into this issue. While I understand that ember doesn't support circle, I do think that it would be nice to at least have the issue fixed in the shipped travisci.yml file. I've also updated the title and description to make it a little more generic and not scoped specifically to circleCI |
@eric-hu many thanks for the detailed advice here. Very helpful for the community to understand what's going on in detail. It would be great to see a canonical example in the documentation on a per-framework basis, although I understand and appreciate the time this would take. @bgentry thanks for reporting on the time difference. I was hoping that it would speed up the build times. I'm going to set |
This is recommended here: emberjs/ember.js#15641 (comment)
Thanks to this thread for the solution to builds timing out: emberjs/ember.js#15641
oh wow, I’m glad I finally found this conversation, because this has been happening to me too. I didn’t know what to look for at first because Changing to Maybe this was only happening to me on Travis because the application has heavy dependencies, but it was difficult to debug and I just ignored it for a long while, so it does seem worth considering how to handle this in the Ember CLI blueprint or otherwise address it. |
In my testing a default out of the box ember project without any changes does pass fine, the introduction of a bunch of dependencies does end up causing the error. I'm not sure what is considered a 'lot' of dependencies in an ember project. But with travis being the de-facto way to do CI with ember addons, I think as people start upgrading / making new addons people are going to see this more and more. I recently started working on upgrading all the dependencies for the ember-burger-menu project and am getting this error. |
discussion here: emberjs/ember.js#15641 TLDR circle, using docker, reports the available cores of the hardware, not the VM to broccoli bable transpiler, which uses this max number to transpile, which eats up all the memory. the `JOBS` envvar controls parallelism for BBT
Closing as JOBS=1 was updated as the default in ember-cli a while ago. Sorry for the troubles... |
* #14 make the test suite green * don't use named arguments for now... the ember-named-arguments-polyfill is not working and needs more investigation * set jobs to 1 to avoid memory errors. see emberjs/ember.js#15641 (comment) * circle guarantees 2 cpus; try a different node image * try node 8
I just had to add |
This is to prevent an out of memory error on circle-ci based on emberjs/ember.js#15641
* upgrade ember 3.16 Fixes requirements. Selecting new delivery recipient is broken. Re-enables jquery * fix tests after 3.16 upgrade Skipping onSearch duke-ds-user-search-fields test. This caused tests to repeat again and again. * Revert "fix tests after 3.16 upgrade" This reverts commit 7bfd6da. * fix tests and lint settings lint settings: ember/no-jquery off ember/no-new-mixins off ember/no-observers off Fixes tests broken by upgrade to 3.16 * upgrade to node 14.15 for tests Tests fail when using node 8.9 due to this issue: jsdom/jsdom#2963 * set ci jobs to 1 This is to prevent an out of memory error on circle-ci based on emberjs/ember.js#15641 * set JOBS 2 in circleci config
Parallel babel transpiling was introduced in ember 2.15. (https://github.com/babel/broccoli-babel-transpiler#number-of-jobs)
By default, broccoli-babel-transpiler uses system resources (cpus) to determine the amount of jobs that can be ran in parallel.
Most modern CI tools use docker to help isolate builds from other builds running on a given server. This allows them to use large VMs to run lots of builds that are largely isolated from each other. For example, the VMs that Circle CI run on usually have 36 CPU cores... But the builds themselves are limited to two.
The issue comes in when attempting to use traditional means to determine what resources are available to the program. For example, to determine the number of CPUs using node you might do
node -e "console.log(require('os').cpus().length);"
. However, this information actual reports the instance resources, not the limited resources available to the docker container. Resulting in whatever is running thinking it's got access to 36 cores but really it only has two.I've created an example repo:
https://github.com/mwisner/ember-circleci-example in which you can see both passed and failed build history (https://circleci.com/gh/mwisner/ember-circleci-example) (https://travis-ci.org/mwisner/ember-circleci-example/builds) (I have not fixed the travis build yet.)
Tested CI tools
-- Circle CI 2.0
-- Circle CI 1.0
-- Travis CI (Failing with default provided Travis CI)
Parallel jobs docs: https://github.com/babel/broccoli-babel-transpiler#number-of-jobs
When errors do come up they look something like like the output below. However in many situations (such as travis CI) it simply times out after 10mins without any information)
The "Workaround" solution, provided by @rwjblue, is to specifically define the number of jobs you wish use for parallel transpiling by taking advantage of the
JOBS
ENV var. (https://github.com/mwisner/ember-circleci-example/blob/09c63e11c34d4cdfe602b63166b71e6f31e30f3c/.circleci/config.yml#L42)The text was updated successfully, but these errors were encountered: