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

Run eslint -> JavaScript heap out of memory #1883

Open
ximex opened this issue Dec 13, 2022 · 38 comments
Open

Run eslint -> JavaScript heap out of memory #1883

ximex opened this issue Dec 13, 2022 · 38 comments
Assignees

Comments

@ximex
Copy link

ximex commented Dec 13, 2022

🐛 Bug Report

If i run eslint i got this error since i18next v2.4.4. It comes from the rules "@typescript-eslint/no-misused-promises". I don't know if it is a @typescript-eslint or i18next bug.
With v2.4.3 or before there are no problems.

> eslint ./


<--- Last few GCs --->

[12938:0x67d8210]    77956 ms: Mark-sweep (reduce) 1881.7 (1921.3) -> 1881.7 (1914.3) MB, 950.8 / 0.0 ms  (average mu = 0.564, current mu = 0.000) last resort; GC in old space requested
[12938:0x67d8210]    78893 ms: Mark-sweep (reduce) 1881.7 (1914.3) -> 1881.7 (1914.3) MB, 936.6 / 0.0 ms  (average mu = 0.379, current mu = 0.000) last resort; GC in old space requested


<--- JS stacktrace --->

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0xb6e500 node::Abort() [node]
 2: 0xa7e632  [node]
 3: 0xd47f20 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd482c7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xf137bf v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 6: 0xef3b80 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
 7: 0xeeb14c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
 8: 0xeeb2c5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
 9: 0x11a493e v8::internal::MaybeHandle<v8::internal::OrderedHashMap> v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate<v8::internal::Isolate>(v8::internal::Isolate*, int, v8::internal::AllocationType) [node]
10: 0x11a49f3 v8::internal::MaybeHandle<v8::internal::OrderedHashMap> v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashMap>, int) [node]
11: 0x12ae96d v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x16e99f9  [node]
Aborted (core dumped)

To Reproduce

run eslint with rule "@typescript-eslint/no-misused-promises"

Expected behavior

That eslint runs through again

Your Environment

  • runtime version: node v18.12.1
  • i18next version: v2.4.5
  • os: Linux
@adrai
Copy link
Member

adrai commented Dec 13, 2022

Can you please provide a minimal repository so we can reproduce this?

@esetnik
Copy link

esetnik commented Dec 14, 2022

I have confirmed the same issue in my project. Both v2.4.4 and v2.4.5 are affected.

@jansedlon
Copy link

jansedlon commented Dec 15, 2022

Mine as well. When I run tsc with version 2.4.5 it crashes with the same error. It runs out of memory. Version 22.4.3 is the latest that works fine

@esetnik
Copy link

esetnik commented Dec 20, 2022

@adrai Same issue on v22.4.6

@stale
Copy link

stale bot commented Dec 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added stale and removed stale labels Dec 31, 2022
@esetnik
Copy link

esetnik commented Jan 2, 2023

Mark as not stale

@esetnik
Copy link

esetnik commented Jan 4, 2023

Still happening on v22.4.8

@esetnik
Copy link

esetnik commented Jan 4, 2023

Is this related to #1857?

@stale
Copy link

stale bot commented Jan 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 17, 2023
@ximex
Copy link
Author

ximex commented Jan 17, 2023

Mark as not stale

@CreativeTechGuy
Copy link

Minimal repo is now available here: #1901 @adrai. Hope this helps!

@esetnik
Copy link

esetnik commented Feb 17, 2023

I can confirm this is still occurring on v22.4.10

@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 18, 2023
@adrai adrai removed the stale label Mar 18, 2023
@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 2, 2023
@adrai adrai removed the stale label Apr 2, 2023
@stale
Copy link

stale bot commented May 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 4, 2023
@adrai adrai removed the stale label May 4, 2023
@stale stale bot added the stale label Jun 15, 2023
@adrai adrai removed the stale label Jun 15, 2023
@adrai
Copy link
Member

adrai commented Jun 15, 2023

Please try with i18next v23.0.1 and react-i18next v13.0.0

@esetnik
Copy link

esetnik commented Jun 15, 2023

@adrai see #1972

@pedrodurek
Copy link
Member

Hey @esetnik, we really need a reproducible example to investigate what should be the root cause 😢

@esetnik
Copy link

esetnik commented Jun 22, 2023

@pedrodurek sorry I have been trying to build a reproducible example but I cannot even get the example I put together to typecheck cleanly due to i18next/react-i18next#1647 so I cannot provide a full example which demonstrates this issue.

@adrai
Copy link
Member

adrai commented Jul 26, 2023

Can you try if it's better with v23.3.0?

@esetnik
Copy link

esetnik commented Jul 26, 2023

Unfortunately no it's the same issue

@adrai
Copy link
Member

adrai commented Jul 28, 2023

Unfortunately no it's the same issue

@ximex and for you?

@ximex
Copy link
Author

ximex commented Aug 7, 2023

"i18next": "^23.4.2",
"react-i18next": "^13.0.3",

with this versions tested it looks like it is fixed.

@adrai
Copy link
Member

adrai commented Aug 7, 2023

So can we close this issue?

@ximex
Copy link
Author

ximex commented Aug 7, 2023

For me it is fixed. @esetnik also for you?

@esetnik
Copy link

esetnik commented Aug 7, 2023

I am still experiencing the issue and stuck on the older version until it is resolved. The last version that is able to lint my project without Allocation failed - JavaScript heap out of memory errors is:

@omoifodarling
Copy link

omoifodarling commented Aug 7, 2023 via email

@adrai
Copy link
Member

adrai commented Aug 7, 2023

@esetnik seems @pedrodurek is still waiting for an example by you?

@esetnik
Copy link

esetnik commented Aug 7, 2023

@ximex can you tell me which versions of @typescript-eslint you are using and provide me with your eslint config? I'd like to try to reproduce it using your configs since they are working for you.

@ximex
Copy link
Author

ximex commented Aug 8, 2023

it worked with 5.62.0 and also with 6.3.0

the config (@typescript-eslint@^6.3.0) without the huge list of rules:

module.exports = {
	"root": true,
	"env": {
		"browser": true,
		"node": true,
		"commonjs": true,
		"es2023": true,
		"jest/globals": true,
	},
	"parser": "@typescript-eslint/parser",
	"parserOptions": {
		"ecmaVersion": 2023,
		"sourceType": "module",
		"ecmaFeatures": {
			// "impliedStrict": true,
			"jsx": true,
		},
		"project": true,
		"extraFileExtensions": [".json"],
	},
	"settings": {
		"react": {
			"version": "detect",
		},
		// "jest": {
		// 	"version": "29",
		// },
	},
	"plugins": [
		"@typescript-eslint",
		"react",
		"react-hooks",
		"i18next",
		"jest",
		"jest-extended",
	],
	"extends": [
		"eslint:recommended",
		"plugin:node/recommended",
		"plugin:react/jsx-runtime",
	],
	"rules": {
		...
	},
};

@esetnik
Copy link

esetnik commented Aug 8, 2023

@ximex do you have @typescript-eslint/no-misused-promises enabled?

@ximex
Copy link
Author

ximex commented Aug 9, 2023

yes

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 17, 2023
@adrai adrai removed the stale label Sep 17, 2023
@esetnik
Copy link

esetnik commented Sep 18, 2023

please mark as not stale

@bencerf
Copy link

bencerf commented Dec 13, 2023

"i18next": "^23.4.2",
"react-i18next": "^13.0.3",

with this versions tested it looks like it is fixed.

I confirm what @ximex said, with theses version, i don't have any more JS heap out of memory error !! 👏 🙌
EDIT: after developping more, I got the JS heap out of memory error... 😭

We're just upgrading from v22 to @latest v23 (see below) but TSC just die after making any changes and waiting 15sec...
image

Here our short listed package.json that failed :

"dependencies": {
  // ...
  "i18next": "^23.7.7",
  "i18next-chained-backend": "^4.6.2",
  "i18next-http-backend": "^2.4.2",
  "i18next-parser": "^8.9.0",
  "i18next-resources-to-backend": "^1.2.0",
  // ...
  "react-i18next": "^13.5.0"
},

Fyi, our devDependencies:

"devDependencies": {
  // ...
  "@typescript-eslint/eslint-plugin": "^5.60.1",
  "@typescript-eslint/parser": "^5.60.1",
  // ...
  "eslint": "^8.43.0",
  "eslint-config-prettier": "^8.8.0",
  "eslint-config-standard": "^17.1.0",
  "eslint-plugin-import": "^2.27.5",
  "eslint-plugin-no-restricted-imports": "^0.0.0",
  "eslint-plugin-playwright": "^0.15.3",
  "eslint-plugin-prettier": "^4.2.1",
  "eslint-plugin-react": "^7.32.2",
  "eslint-plugin-react-hooks": "^4.6.0",
  "eslint-plugin-simple-import-sort": "^10.0.0",
  "eslint-plugin-unused-imports": "^2.0.0"
  // ...
},

I don't really know how I could provide a reproducible example repository for this sort of bug, sorry...

@bencerf
Copy link

bencerf commented Dec 14, 2023

Sorry about my previous comment, we finally managed to fix our Error: Worker terminated due to reaching memory limit: JS heap out of memory by increasing virtual memory (NODE_OPTIONS) of node with 8Gb (as explained here).

Working for us with @latest i18next & react-i18next :

    "dependencies": {
      "i18next": "^23.7.7",
      "i18next-chained-backend": "^4.6.2",
      "i18next-http-backend": "^2.4.2",
      "i18next-parser": "^8.9.0",
      "i18next-resources-to-backend": "^1.2.0",
      // ...
      "react-i18next": "^13.5.0"
    },

Here our script using vite :

  "scripts": {
    "start": "export NODE_OPTIONS=--max-old-space-size=8192 && vite",
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants