Skip to content
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

high ram/memory usage #782

Closed
ghost opened this issue Oct 18, 2019 · 9 comments
Closed

high ram/memory usage #782

ghost opened this issue Oct 18, 2019 · 9 comments
Labels
info-needed Issue requires more information from poster

Comments

@ghost
Copy link

ghost commented Oct 18, 2019

  • Issue Type: Bug
  • OS Version: Linux x64 5.3.6-1-MANJARO
  • "@typescript-eslint/eslint-plugin": "2.4.0",
  • "@typescript-eslint/parser": "2.4.0",
  • "eslint": "6.5.1",
  • "eslint-config-prettier": "6.4.0",
  • "eslint-plugin-prettier": "3.1.1",
  • "eslint-plugin-promise": "4.2.1",

The Ram usage of eslint is very high (~2,4GiB).
Is this normal for this many rules and plugins?
Is this a eslint or a typescript-eslint problem?

ram

eslintrc.json
{
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:@typescript-eslint/recommended-requiring-type-checking",
        "prettier",
        "prettier/@typescript-eslint",
        "plugin:prettier/recommended",
        "plugin:promise/recommended"
    ],
    "parser": "@typescript-eslint/parser",
    "plugins": ["@typescript-eslint", "prettier", "promise"],
    "env": {
        "node": true
    },
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "project": "./tsconfig.json",
        "ecmaFeatures": {
            "modules": true
        }
    },
    "reportUnusedDisableDirectives": true,
    "rules": {
        "prettier/prettier": "warn",
        "semi": ["warn", "always"],
        "prefer-const": "warn",
        "max-lines": [
            "error",
            {
                "max": 300,
                "skipComments": false,
                "skipBlankLines": false
            }
        ],
        "arrow-body-style": "error",
        "curly": "warn",
        "dot-notation": "error",
        "eol-last": "error",
        "no-caller": "error",
        "no-debugger": "error",
        "no-new-wrappers": "error",
        "no-throw-literal": "error",
        "no-undef-init": "error",
        "no-var": "error",
        "radix": "error",
        "no-alert": "error",
        "no-console": ["error", { "allow": ["warn", "error", "log"] }],
        "no-proto": "error",
        "no-new-func": "error",
        "lines-between-class-members": [
            "warn",
            "always",
            {
                "exceptAfterSingleLine": true
            }
        ],
        "spaced-comment": "warn",
        "guard-for-in": "warn",
        "prefer-spread": "off",
        "no-restricted-imports": ["error", "rxjs/Rx"],
        "quotes": ["warn", "single"],
        "quote-props": ["warn", "as-needed"],
        "max-lines-per-function": ["warn", { "max": 75, "skipComments": true }],
        "@typescript-eslint/no-namespace": "off",
        "@typescript-eslint/camelcase": "warn",
        "@typescript-eslint/type-annotation-spacing": "warn",
        "@typescript-eslint/no-inferrable-types": [
            "warn",
            {
                "ignoreParameters": true,
                "ignoreProperties": false
            }
        ],
        "@typescript-eslint/no-explicit-any": "warn",
        "@typescript-eslint/consistent-type-assertions": "warn",
        "@typescript-eslint/no-empty-interface": "error",
        "@typescript-eslint/no-misused-new": "error",
        "@typescript-eslint/no-non-null-assertion": "error",
        "@typescript-eslint/member-ordering": "warn",
        "@typescript-eslint/unified-signatures": "warn",
        "@typescript-eslint/consistent-type-definitions": ["warn", "interface"],
        "@typescript-eslint/class-name-casing": "warn",
        "@typescript-eslint/no-use-before-define": "off",
        "@typescript-eslint/unbound-method": [
            "error",
            {
                "ignoreStatic": true
            }
        ],
        "@typescript-eslint/explicit-member-accessibility": ["warn", { "accessibility": "no-public" }],
        "@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true }]
    }
}
@mustafa-cosar
Copy link

mustafa-cosar commented Oct 18, 2019

I was just about to open an issue. The extension consistently runs out of memory and crashes.
Note: I think max memory size is 1.7 gb by default.

<--- Last few GCs --->

[31560:0x55a64d3fa850]    44917 ms: Mark-sweep 1380.2 (1448.5) -> 1367.6 (1450.5) MB, 489.9 / 0.7 ms  (average mu = 0.129, current mu = 0.083) allocation failure scavenge might not succeed
[31560:0x55a64d3fa850]    45522 ms: Mark-sweep 1381.4 (1450.5) -> 1368.4 (1451.0) MB, 575.0 / 0.9 ms  (average mu = 0.088, current mu = 0.049) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x18fdbfcdbe1d]
    1: StubFrame [pc: 0x18fdbfcc16d5]
Security context: 0x344f0de1e6e9 <JSObject>
    2: /* anonymous */(aka /* anonymous */) [0x344f0de1d8a1](this=0x0af2fe3826f1 <undefined>,0x3fe91ec67f81 <JSGenerator>,0x3fe91ec68891 <Promise map = 0x1a39f4403fe9>,0x3fe91ec67fd1 <Promise map = 0x1a39f4403fe9>)
    3: _addToNodeFs [0x2e5461eae661] [/opt/unscrambl/drive/ub18/npm-toolchain-1.0.12/node_modules/chokidar/...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x55a6483bccc0 node::Abort() [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 2: 0x55a6483bcd0e  [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 3: 0x55a6485eb672 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 4: 0x55a6485eb9c8 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 5: 0x55a648a3e672  [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 6: 0x55a648a4f1fc v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 7: 0x55a648a4fd0f v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 8: 0x55a648a52525 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
 9: 0x55a648a19374 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
10: 0x55a648ced7ae v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/unscrambl/chai/ub18/node-10.16.3-npm-6.12.0/bin/node]
11: 0x18fdbfcdbe1d 
[Info  - 4:14:54 PM] Connection to server got closed. Server will restart.
[Info  - 4:14:54 PM] ESLint server stopped.
[Info  - 4:14:54 PM] ESLint server stopped.

@dbaeumer
Copy link
Member

@BO41 can you provide me with a GitHub repository I can clone that demos this. I think this is at the end a TSLint plugin issue which hangs onto the memory. So it depends on the workspace.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Oct 18, 2019
@ghost
Copy link
Author

ghost commented Oct 18, 2019

I can try to make a minimal viable repo to reproduce.
If this is really a problem of the TSLint plugin, then feel free to move this issue to their tracker 😉

@dbaeumer
Copy link
Member

I will move it after I investigate the repro. I want to be sure it is them :-)

@ghost
Copy link
Author

ghost commented Oct 21, 2019

I can't share the repo I am having the problem with.
But I assume it needs to be a "big" one, or one with angular. And I can investigate if this has something to do with angular.

But I tried to open the project in vim (+ eslint integration) and the same thing happened.

So it is not a problem of vscode-eslint 😉
Either eslint or typescript-eslint

@dbaeumer thanks for the help
@mustafa-cosar if your described problem is still open, please open a separate issue

@dbaeumer
Copy link
Member

I am pretty sure it is typescript-eslint. Depending on the enabled rule this might construct the whole project in memory. The only fix I see right now is to support #733.

I will close the issue.

@ghost
Copy link
Author

ghost commented Oct 24, 2019

@mustafa-cosar I think your problem got fixed in typescript-eslint/typescript-eslint#1107 with the new 2.5.0 of typescript-eslint

@ghost
Copy link
Author

ghost commented Oct 24, 2019

Issue got mostly resolved duo to an update of typescript-eslint to version 2.5.0 (just released) which drops the ram usage to about ~1GiB 🎉 and also fixes some other bugs 🎉 🎉

@mustafa-cosar
Copy link

Thanks for the heads-up

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants