question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug since v2.0.0 — RangeError: Maximum call stack size exceeded

See original GitHub issue

Environment

  • OS Version: Fedora Linux 4.14.14-300.fc27.x86_64
  • Node.js Version: v9.4.0

Actual behavior

Since v2.0.0 an error is thrown when run on a filesystem. Number of files/dirs is 54/18 in my case.

Call stack:

yarn run v1.3.2
$ OVERRIDE_ENV=development npm run build

> app@0.0.0 build /home/max/Development/example/packages/app
> APP_RELEASE=$(git describe --always) NODE_ENV=production node build/build.js

/home/max/Development/example/node_modules/fast-glob/out/providers/reader-sync.js:40
            throw err;
            ^

RangeError: Maximum call stack size exceeded
    at call.safe (/home/max/Development/example/node_modules/readdir-enhanced/lib/stat.js:26:26)
    at onceWrapper (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:45:17)
    at onceWrapper (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:45:17)
    at exports.lstat (/home/max/Development/example/node_modules/readdir-enhanced/lib/sync/fs.js:59:5)
    at Object.safeCall [as safe] (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:24:8)
    at stat (/home/max/Development/example/node_modules/readdir-enhanced/lib/stat.js:19:8)
    at DirectoryReader.processItem (/home/max/Development/example/node_modules/readdir-enhanced/lib/directory-reader.js:171:5)
    at array.forEach.item (/home/max/Development/example/node_modules/readdir-enhanced/lib/sync/for-each.js:14:5)
    at Array.forEach (<anonymous>)
    at Object.syncForEach [as forEach] (/home/max/Development/example/node_modules/readdir-enhanced/lib/sync/for-each.js:13:9)
    at call.safe (/home/max/Development/example/node_modules/readdir-enhanced/lib/directory-reader.js:80:16)
    at onceWrapper (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:45:17)
    at onceWrapper (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:45:17)
    at exports.readdir (/home/max/Development/example/node_modules/readdir-enhanced/lib/sync/fs.js:19:5)
    at Object.safeCall [as safe] (/home/max/Development/example/node_modules/readdir-enhanced/lib/call.js:24:8)
    at DirectoryReader.readNextDirectory (/home/max/Development/example/node_modules/readdir-enhanced/lib/directory-reader.js:71:10)

npm ERR! Linux 4.14.14-300.fc27.x86_64
npm ERR! argv "/usr/bin/node" "/home/max/.config/yarn/global/node_modules/.bin/npm" "run" "build"
npm ERR! node v9.4.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! app@0.0.0 build: `APP_RELEASE=$(git describe --always) NODE_ENV=production node build/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the app@0.0.0 build script 'APP_RELEASE=$(git describe --always) NODE_ENV=production node build/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     APP_RELEASE=$(git describe --always) NODE_ENV=production node build/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/max/Development/example/packages/app/npm-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks to be related to readdir-enhanced.

Expected behavior

fast-glob runs without any error thrown.

Steps to reproduce

  1. Nothing specific, just run fast-glob.

Code sample

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

const paths = fastGlob.sync([
  path.join(__dirname, './**/*.html'),
  path.join(__dirname, './**/*.js'),
]);

NOTE

Since v2.0.0 has removed bashNative mode, I’m actually going to pin my fast-glob version to 1.0.1 anyway since I want that native level of performance. That was actually the reason why I started using fast-glob in the first place!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mrmlnccommented, Jan 23, 2018

Thanks for provided details.

I’ll work on your problem tonight. Now you can exclude node_modules directory from reading by !**/node_modules pattern. Also you can exclude dest and other not needed directories.

Sorry for this situation.

0reactions
maxmiltoncommented, Feb 19, 2018

Sorry I hadn’t gotten back to this thread sooner. I can confirm on the current v2.0.4 the issue I originally raised is no long reproducible.

Thank you for your hard work on this project! 🌟

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
This error is a RangeError. A RangeError typically means an error has occurred outside of a code's argument value for its parameter. Now...
Read more >
JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >
Chrome Update caused : Maximum call stack size exceeded.
according to last update on google chrome browser we got the below error on our production. Uncaught RangeError: Maximum call stack size exceeded....
Read more >
Debug Range Error Maximum call stack size exceeded
Debug Range Error Maximum call stack size exceeded #vscode #javascript #shorts #debug #100daysofcode. ... 721 views 2 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found