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

Many files in a src() leads to stack overflow #341

Closed
tom-- opened this issue Mar 12, 2014 · 2 comments
Closed

Many files in a src() leads to stack overflow #341

tom-- opened this issue Mar 12, 2014 · 2 comments

Comments

@tom--
Copy link

tom-- commented Mar 12, 2014

It seems a ~10,000 file count in the src of a gulp.src().pipe(gulp.dest()) task
overflows the stack:

/Users/tom/gulp.test/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:0
(function (exports, require, module, __filename, __dirname) { /*jshint node:tr
^
RangeError: Maximum call stack size exceeded

I got this with a dir containing 8072 regular files in 207 dirs. I can recreate the
error with simple synthetic test cases and this gulpfile:

var gulp = require('gulp');

gulp.task('default', function () {
    return gulp.src('foo/**')
        .pipe(gulp.dest('bar'));
});

Sometimes the gulp task fails only on a second run, after the bar directory is
populated. In other words, sometimes this triggers the error:

rm -rf bar && gulp

while sometimes it doesn't but this does:

rm -rf bar && gulp
gulp

The "sometimes" seems to depends on the content of foo but that's all I know.

Feel free to experiment using my test case generator.

@yocontra
Copy link
Member

Interesting, probably coming from deep under the hood when globbing. I'll check it out and make a test case for this when I have a minute

@yocontra
Copy link
Member

Moving to the correct repo gulpjs/vinyl-fs#14

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

No branches or pull requests

2 participants