-
Notifications
You must be signed in to change notification settings - Fork 25
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
EventEmitter memory leak warning #7
Comments
The warning is "normal" and simply means you're processing more than 10 files in parallel. gulp-run spawns a new process to handle every file it receives as input and processes them in parallel. For each file, a logger object is created to handle piping the stdout of the child process to the stdout of the main process. Piping involves creating event listeners on This log system could definitely be refactored to avoid this, but no memory is actually being leaked (as of 9303018), so you can safely increase the listener count on Consider the following two examples that run Parallel Examplevar count = 100;
function almostDone() {
count -= 1;
if (count === 0) done();
}
for (var i = count; i > 0; i -= 1) {
run('test a = a').exec(almostDone);
} Since Series Examplevar count = 100;
function test() {
run('test a = a').exec(function () {
count -= 1;
if (count > 0) test();
else done();
});
}
test(); This example also spawns 100 processes, but it waits for the previous to finish before spawning the next. In this case, you won't see the warning because each process releases it's listeners before the next process starts. And since the warning is not thrown, this example shows that each execution properly cleans up after itself. The solutionAs far as I can tell, the solution is |
Awesome, thanks so much for this detailed explanation. This all makes perfect sense. The concurrency is definitely desirable! |
- The code is simpler and easier to read - You can now give standard input to `run(...).exec([stdin], [callback])` as a String, Buffer, or Vinyl file - A new `Command` class is exposed for running commands outside of gulp - Fixes #8 - No need to set the max listeners on `process.stdout` (#7) - Removed dependency on CircularBuffer
I recently published a rewrite that avoids the issue altogether. See v1.6.0 and the updated readme. |
I'm using gulp-run in conjunction with gulp-tap to pass the paths of files I'm watching on to a
theme upload
command in shopify_theme Ruby gem. Generally this works but I've started seeing the following warning as the number of files in my project increases. The uploads are still successful, but this is making for some noisy log output.(example gulp-run log output)
Not sure if this is related to gulpjs/gulp#432 but seems to be coming from
Transform.commandStream.exec
in gulp-run. I'm running 0.10.28.The text was updated successfully, but these errors were encountered: