Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@tom--

Description

@tom--

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions