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

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #294

Open
schuettc opened this issue Apr 3, 2023 · 6 comments
Labels

Comments

@schuettc
Copy link

schuettc commented Apr 3, 2023

Issue Report

When attempting to run repolinter.js via node, getting this error.

Expected Behavior

repolinter.js should complete

Actual Behavior

repolinter.js failed with the following error:

<--- Last few GCs --->

[96417:0x128008000]   468543 ms: Mark-sweep 16116.2 (16423.6) -> 16106.2 (16427.1) MB, 4611.4 / 0.3 ms  (average mu = 0.287, current mu = 0.004) allocation failure scavenge might not succeed
[96417:0x128008000]   477428 ms: Mark-sweep 16122.0 (16427.1) -> 16111.9 (16432.1) MB, 8867.6 / 0.3 ms  (average mu = 0.120, current mu = 0.002) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Steps to Reproduce the Issue

node bin/repolinter.js lint ../repo-to-lint -r ../ruleset.json

Other notes

Have increased "max-old-space-size" to 16384 by:

export NODE_OPTIONS="--max-old-space-size=16384"

With no effect.

Have attempted using node v18.16.0 and v16.19.0

Using M1 Mac.

@zhaoyuheng200
Copy link
Member

I've seen this issue before and it happened on a repository node_modules folder with symlink in it.
Assuming that's a nodejs repository you are linting, can you try remove node_modules or any thing similar and lint again?

@schuettc
Copy link
Author

schuettc commented Apr 4, 2023

Tried that with no change. The original repo was created with projen. Any issues there?

@zhaoyuheng200
Copy link
Member

Since symlink was the root cause of my issue at the time, I just tied the problem to that.
From here I can only think of 2 things to do:

  1. List all symlinks in the project by ls -lR /path/to/folder | grep ^l, ref: link
  2. link each dir in every layer until you locate the dir/file that's causing the issue. I'm only recommending this on the belief that there is nothing wrong with repolinter and there is a symlink there somewhere, so increase space size won't solve your problem.

@zhaoyuheng200
Copy link
Member

btw if you can share your ruleset, that can be helpful.

@hyandell
Copy link
Member

hyandell commented Apr 6, 2023

Noting that you both work at AWS; so perhaps contacting each other internally will allow you to share the rules/codebase in question for better replication.

@hyandell hyandell added the bug label Apr 6, 2023
@hakanson
Copy link

I was able to track this down to a set of "type": "file-not-contents" rules. My project was a monorepo with node_modules and some rust compiled to WASM. Too many files were being scanned.

I avoided this error two different ways:

  1. Delete these rule definitions (used to isolate rule)
  2. Run repolint on a local git clone (eg. git clone ~/src/project newproject

It would be nice if anything in the .gitignore could be excluded from globsAll option for this rule.

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

No branches or pull requests

4 participants