-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
There is a new Jest memory leak after updating to v7.7 #1217
Comments
@nrwl/nx v7.7 includes a new version of
So it would be nice if there is an option added in nx to disable the diagnostics in But anyway, if your app gets bigger at some you will reach the default memory limit in node.js (~1.5 GB). We already have that problem. As suggested in the @angular/cli repo we manually increase the memory limit for all test and build runs.
|
I'm aware that we will need more memory at some point but before the update, ~500mb was enough. More memory being needed or even tests being slower is not really a problem. The problem is that no memory is being freed between test suites as you can see in my log. I'll create a patch to disable diagnostics in |
I've created a patch to disable This is the patch: diff --git a/node_modules/@nrwl/builders/src/jest/jest.builder.js b/node_modules/@nrwl/builders/src/jest/jest.builder.js
index b87e9e5..434d3ed 100755
--- a/node_modules/@nrwl/builders/src/jest/jest.builder.js
+++ b/node_modules/@nrwl/builders/src/jest/jest.builder.js
@@ -14,6 +14,7 @@ var JestBuilder = /** @class */ (function () {
JestBuilder.prototype.run = function (builderConfig) {
var options = builderConfig.options;
var tsJestConfig = {
+ diagnostics: false,
tsConfig: path.join('<rootDir>', path.relative(builderConfig.root, options.tsConfig))
};
// TODO: This is hacky, We should probably just configure it in the user's workspace
@@ -29,6 +30,8 @@ var JestBuilder = /** @class */ (function () {
}
catch (e) { }
var config = {
+ detectOpenHandles: true,
+ logHeapUsage: true,
watch: options.watch,
coverage: options.codeCoverage,
bail: options.bail, This is the new log:
|
Great debugging! Can you reproduce with a more minmal project? It seems the way With my test project, I see this: which may have a more minor memory leak? LOGS
|
@FrozenPandaz it works fine locally actually. My logs are from GitLab runners. I'm a bit short of time right now, but I'll see if I can come up with some repo. ): |
Hi, I have the same error, but I'm running my test suite on TravisCI, here is the repo I'm working on: https://github.com/llstarscreamll/angular-kirby I have tried many things to fix the error, but nothing works... some links: jestjs/jest#7647 Here is the logs from my failed builds: https://github.com/llstarscreamll/angular-kirby On my local machine all the tests are green. |
Hi every one, my build is now passing!! I upgrade some dependencies and change TravisCI setup to this: language: node_js
node_js: 12
dist: trusty
sudo: required
cache:
npm: false
install:
- yarn install --network-timeout 1000000
notifications:
email: true
branches:
except:
- /^v\d+\.\d+\.\d+$/
script: ng test -i --ci --bail=1 --pass-with-no-tests |
@llstarscreamll what dependencies did you upgrade to make the build pass? |
Here is the diffs from the dependencies changes, including the TravisCI setup: |
Just confirming. It looks like the issue has been fixed in 8.5. Right? |
Closing this issue due to inactivity. If the problem persists, please reopen the issue. Thank you. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Expected Behavior
My test suite runs without memory leaks.
Current Behavior
My test suite leaks between 50 and 100mb between each lib/app run.
Failure Information
I'm guessing there's a bug somewhere, but can't say for sure where. I've tried to exclude Jest itself from the equation because the memory leak seems to happen between suites and not within a suite.
Steps to Reproduce
All I did was update to @nrwl/nx v7.7 and all related dependencies as usual. It wasn't leaking in v7.6.
So I guess if anyone has a repo using Jest unit tests, that's all that is needed.
Context
Please provide any relevant information about your setup:
Failure Logs
Example run after the update:
The text was updated successfully, but these errors were encountered: