Upgrading from v5.11.x to v5.13.x causes memory leaks in ESLint
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
Crashes while running ESLint due to OOM:
$ eslint . --ext js --ext ts --ext tsx --ext json
<--- Last few GCs --->
[2322:0x6250a20] 86941 ms: Mark-sweep (reduce) 2042.3 (2054.1) -> 2041.4 (2054.3) MB, 2064.6 / 0.0 ms (average mu = 0.110, current mu = 0.056) allocation failure scavenge might not succeed
[2322:0x6250a20] 89098 ms: Mark-sweep (reduce) 2042.5 (2051.3) -> 2041.7 (2052.8) MB, 2152.4 / 0.0 ms (average mu = 0.057, current mu = 0.002) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa389b0 node::Abort() [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
2: 0x96e0af node::FatalError(char const*, char const*) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
5: 0xd73fd5 [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
6: 0xd74b5f [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
7: 0xd8299b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
8: 0xd8655c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
9: 0xd4bd2d v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
10: 0xd47f89 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
11: 0xd48044 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
12: 0xf8f6de v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::AllocationType) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
13: 0xf8f876 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashMap>, int) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
14: 0x1081088 v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
15: 0x1446379 [/opt/hostedtoolcache/node/14.18.2/x64/bin/node]
Aborted (core dumped)
error Command failed with exit code 134.
If the current behavior is a bug, please provide the steps to reproduce.
- Upgrade to latest Mongoose v5.13.x patch
- ESLint will blow up
TSConfig:
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"lib": [
"es2020.Promise"
] /* Specify library files to be included in the compilation. */,
"allowJs": true /* Allow javascript files to be compiled. */,
"checkJs": false /* Report errors in .js files. */,
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist" /* Redirect output structure to the directory. */,
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [
/* List of folders to include type definitions from. */ "./src/types",
"node_modules/@types",
"../node_modules/@types"
],
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
"resolveJsonModule": true,
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}
What is the expected behavior?
My ESLint task doesn’t fail due to OOM
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version.
- Mongoose v5.11.13
- MongoDB v4.4.x
- NodeJS v14.x
I’d love to use the latest version of Mongoose but upgrading it at all tends to break.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top Results From Across the Web
Possible memory leak after upgrade to Storybook 6.5.10 #18971
Hello, After upgrading to storybook 6.5.10 frequently I'm getting some kind of memory leak. I'm making in a react library with typescript.
Read more >How to increase EsLint memory to avoid `JavaScript heap out ...
The problem is that trying to run EsLint on this file results in a JavaScript heap out of memory error. How can I...
Read more >Solved: Fortios 7.0.x memory leak? - Fortinet Community
After upgrading our Fortigate 600E (two firewalls in HA) first to FortiOS 7.0.4 then later 7.0.5 we are experiencing what I suspect is...
Read more >Releases - styled-components
Fix SSR collisions caused by insufficient hash inputs and reordering of groups on the client, which is a regression in v5.2.0 (See #3563)....
Read more >Deprecations by version - GitLab Docs
The merge_status field will be removed in v5 of the GitLab REST API. ... Upgrading to PostgreSQL 13 is not yet supported for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re trying to deal with the major version upgrade to fix these issues but I have to be honest, I’m not really looking forward to it. Lots of work and risk on our part just because Mongoose doesn’t play nice with TypeScript?
@vkarpov15 Also have
skipLibCheck
true
. Can confirm after running “–generateTrace” with typescript build, the build slows significantly and specifically on our model declaration files until it comes to a halt running out of memory. Still in the middle of profiling the build. Can confirm thatmongoose@6.1.7
resolves this issue, but hoping to delay the major upgrade.