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

Memory error #746

Closed
christianalfoni opened this issue Jan 13, 2017 · 3 comments

Comments

@christianalfoni
Copy link

commented Jan 13, 2017

Hi there!

Monorepos are becoming more and more popular and it seems that standard gets into issues with multiple packages in one repo.

This is the error I get when I try to lint our monorepo:

<--- Last few GCs --->

   70345 ms: Mark-sweep 1345.7 (1435.2) -> 1345.7 (1435.2) MB, 1763.1 / 1.3 ms [allocation failure] [GC in old space requested].
   72108 ms: Mark-sweep 1345.7 (1435.2) -> 1345.7 (1435.2) MB, 1762.5 / 1.4 ms [allocation failure] [GC in old space requested].
   73943 ms: Mark-sweep 1345.7 (1435.2) -> 1345.7 (1404.2) MB, 1834.7 / 1.3 ms [last resort gc].
   75735 ms: Mark-sweep 1345.7 (1404.2) -> 1345.7 (1404.2) MB, 1792.3 / 1.4 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x35f9d0cfb51 <JS Object>
    1: inflight [/Users/christianalfoni/Development/cerebral/node_modules/inflight/inflight.js:~7] [pc=0x3780a4557197] (this=0x35f9d0e6f19 <JS Global Object>,key=0x253882120d61 <String[166]\: lstat\x00/Users/christianalfoni/Development/cerebral/packages/cerebral-router/node_modules/@cerebral/monorepo/debugger/cerebral-debugger/node_modules/combined-stream/lib>,cb=0x253882122339 <JS Function lsta...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewInternalizedStringImpl(v8::internal::Handle<v8::internal::String>, int, unsigned int) [/usr/local/bin/node]
 5: v8::internal::InternalizedStringKey::AsHandle(v8::internal::Isolate*) [/usr/local/bin/node]
 6: v8::internal::StringTable::LookupKey(v8::internal::Isolate*, v8::internal::HashTableKey*) [/usr/local/bin/node]
 7: v8::internal::StringTable::LookupString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>) [/usr/local/bin/node]
 8: v8::internal::LookupIterator::LookupIterator(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>, v8::internal::LookupIterator::Configuration) [/usr/local/bin/node]
 9: v8::internal::LookupIterator::PropertyOrElement(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, bool*, v8::internal::LookupIterator::Configuration) [/usr/local/bin/node]
10: v8::internal::Runtime::GetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/usr/local/bin/node]
11: v8::internal::Runtime_KeyedGetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x3780a42092a7
13: 0x3780a4557197
npm info lifecycle @cerebral/monorepo@0.0.1~postlint: @cerebral/monorepo@0.0.1
[1]    16597 abort      npm run lint

Now, I believe this is related to traversing, because if I delete the node_modules folders of all the packages in the repo the linter works fine.

By default "standard" ignores node_modules folder and we even added an extra config to be certain, from our package.json:

{
  "standard": {
    "parser": "babel-eslint",
    "ignore": [
      "**/node_modules/",
      "**/build/"
    ]
  }
}

Could it be that ignore is only related to actually linting, but it still traverses all files?

I have tried everything... installing latest Node, Npm, delete repo from my machine and clone again. Also tried upping the memory of Node. It just does not work. Funny thing is that it works on some computers. I have a pretty powerful Macbook Pro from 2015.

Any help would be great as this is blocking contributions to our project currently. The repo is: https://github.com/cerebral/cerebral

Run:

npm install
then
npm run setup
and
npm run lint

@feross

This comment has been minimized.

Copy link
Member

commented Jan 20, 2017

You have quite a unique situation. No other user has reported this error before. I took a look into what the glob package is doing and it's not filtering out node_modules right at the beginning of the search process, even though we passed that option.

I posted a comment here: isaacs/node-glob#270 (comment)

Right now, I'm treating this as a bug in glob.

@feross

This comment has been minimized.

Copy link
Member

commented Jan 20, 2017

Ahh, nevermind. This is not a glob bug. Everything is working correctly. The default standard ignore is node_modules/** which only ignores the root node_modules folders. This is why it's doing so much work in your repo.

Your attempt to ignore all them by adding an explicit ignore of **/node_modules/ was the right idea, but you got the syntax wrong. It's supposed to be **/node_modules/**.

If you put that in, standard runs extremely quickly given the gargantuan size of your repo.

@feross feross closed this Jan 20, 2017

@christianalfoni

This comment has been minimized.

Copy link
Author

commented Jan 23, 2017

@feross Ah man! Thanks a bunch :-D

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.