Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. on node 8 #23

Closed
robrichard opened this issue Jan 12, 2018 · 9 comments
Closed

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. on node 8 #23

robrichard opened this issue Jan 12, 2018 · 9 comments
Assignees

Comments

@robrichard
Copy link

I started getting this error when updating from node 6 to node 8. I can reproduce running this code on my large repository but I haven't yet tracked it down to which files are exactly causing it:

const glob = require('fast-glob');

const files = glob.sync('**/*.js', {
    bashNative: [],
    onlyFiles: true,
    cwd: process.cwd(),
    ignore: ['node_modules/**'],
});

console.log(files);
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 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::V8::ToLocalEmpty() [/usr/local/bin/node]
 4: node::ReadDir(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
 6: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 7: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 8: 0x2b0d0ee0463d
 9: 0x2b0d0eef474a

node v8.9.3, macOS 10.13.2

@mrmlnc
Copy link
Owner

mrmlnc commented Jan 12, 2018

Hello, @robrichard,

I will try to reproduce right now.

@mrmlnc
Copy link
Owner

mrmlnc commented Jan 12, 2018

Confirm. This is related to fast-glob.

Steps to reproduce:

  1. Install very «big» packages
$ npm i fast-glob iconv-lite iconv browserify autoprefixer eslint tslint jake xo xterm webpack ava jest babel babel-cli rollup relay relay-compiler
  1. Run script from topic.
Node.js 4.8.6
/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/fast-glob/out/providers/readdir.js:53
        throw err;
        ^

RangeError: Maximum call stack size exceeded
    at Object.fs.lstatSync (fs.js:839:18)
    at Object.exports.lstat (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/sync/fs.js:58:20)
    at stat (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/stat.js:20:6)
    at DirectoryReader.processItem (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/directory-reader.js:168:3)
    at /Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/sync/for-each.js:14:5
    at Array.forEach (native)
    at Object.syncForEach [as forEach] (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/sync/for-each.js:13:9)
    at /Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/directory-reader.js:80:12
    at once (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/once.js:17:17)
    at Object.exports.readdir (/Users/mrmlnc/Documents/Tests/test-big-repo/node_modules/readdir-enhanced/lib/sync/fs.js:19:5)
Node.js 6.12.3, 8.9.0, 9.4.0
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: node::Abort() [/usr/local/nvs/node/9.4.0/x64/bin/node]
 2: node::FatalTryCatch::~FatalTryCatch() [/usr/local/nvs/node/9.4.0/x64/bin/node]
 3: v8::V8::ToLocalEmpty() [/usr/local/nvs/node/9.4.0/x64/bin/node]
 4: node::ReadDir(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/nvs/node/9.4.0/x64/bin/node]
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/nvs/node/9.4.0/x64/bin/node]
 6: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/nvs/node/9.4.0/x64/bin/node]
 7: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/nvs/node/9.4.0/x64/bin/node]
 8: 0x3633e07042fd
Abort trap: 6

@mrmlnc mrmlnc added this to the 1.0.2 milestone Jan 12, 2018
@mrmlnc
Copy link
Owner

mrmlnc commented Jan 21, 2018

Closed in favor of facebook/relay#2295.

@mrmlnc mrmlnc closed this as completed Jan 21, 2018
@remyrylan
Copy link

I'm also hitting this exact error using fast-glob@2.0.1 and node@9.3.0.

@mrmlnc
Copy link
Owner

mrmlnc commented Jan 25, 2018

Hello, @jrylan,

You can provide find . | wc -l and tree -L 1 output for your directory? And please file answer to #42 (comment) question :)

@remyrylan
Copy link

@mrmlnc Thank you so much for all the work with this project and the quick response!

Answers to your questions:

Result of find . | wc -l:
118369

Result of tree -L 1:

├── LICENSE
├── README.md
├── apps
├── commands
├── config.ts
├── data.json
├── dev
├── node_modules
├── package-lock.json
├── package.json
├── packages
├── projectPaths.ts
├── schema.json
├── setup.js
├── sites
├── tsconfig.json
└── tslint.json

6 directories, 11 files

I also have 16GB of RAM on my machine and at the time 9GB of RAM was available.

In this particular case, the pattern I'm providing to fast-glob is not even recursive, I'm basically doing the following:

const packages = fastGlob.sync<string>('[a-z]*', {cwd: PACKAGES_DIR, onlyDirectories: true})

@mrmlnc
Copy link
Owner

mrmlnc commented Jan 26, 2018

Thanks for clarifying the problem! So, we well work on the solution here:

Also you can follow to #42.

@mrmlnc
Copy link
Owner

mrmlnc commented Feb 1, 2018

@jrylan, @robrichard,

Please, try to use npm i fast-glob@next --force for your broken cases. I tried to fix the problem with large directories, temporarily switching to the readdir-enhanced fork.

facebook-github-bot pushed a commit to facebook/relay that referenced this issue Feb 6, 2018
Summary:
* #2042
  * mrmlnc/fast-glob#23

  * Fix for #2042. Now works fine with more then 500 000 entries (maybe more – more I have not tried).
  * Also this is a [new release of `fast-glob` package](https://github.com/mrmlnc/fast-glob/releases/tag/2.0.0), which became even faster and more stable.

  * If you want exclude `node_modules` directory you can use `**/node_modules` pattern ([documentation](https://github.com/mrmlnc/fast-glob#how-to-exclude-directory-from-reading)).

Sorry for the problems from #2042.
Closes #2295

Reviewed By: kassens

Differential Revision: D6770665

Pulled By: jstejada

fbshipit-source-id: dcc0920c75aed32ca0b1d9d34aa6b1fdbeda95be
@Papi3232
Copy link

`root@Synology:/opt/iobroker# npm i fast-glob@next --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
[..................] \ fetchMetadata: sill removeObsoleteDep removing reusify@1.0.4 from the tree as its been replaced by a newer version or is no longer required
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/mrmlnc/readdir-enhanced.git
npm ERR!
npm ERR! error: cannot run ssh: No such file or directory
npm ERR! fatal: unable to fork
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR! /opt/iobroker/.npm/_logs/2023-01-15T06_52_42_319Z-debug.log
root@Synology:/opt/iobroker#
root@Synology:/opt/iobroker# npm i fast-glob@next --force`

I'm afraid that won't work

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

No branches or pull requests

4 participants