Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

warning: possible EventEmitter memory leak detected

Aperta
#64 16 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
build-system

Direzione di ricerca

L'avviso viene attivato da gulpfile.js in rebundle, con la registrazione del listener mostrata in factor-bundle/index.js. Inizia tracciando le chiamate ripetute a bundler.plugin('factor-bundle') nella configurazione watchify fornita e riproduci diversi rebundles. Il lavoro è completato quando i rebundles ripetuti non producono più l'avviso di EventEmitter e gli output condivisi e specifici per file vengono ancora generati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am using factor-bundle with watchify and gulp.

var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var factor = require('factor-bundle');
var uglify = require('gulp-uglify');
var fs = require('fs');
var concat = require('concat-stream');
var file = require('gulp-file');

gulp.task('watch', bundle)

function bundle () {

  // react components
  var files = [
    '/path/to/file1.jsx',
    '/path/to/file2.jsx',
    '/path/to/file3.jsx'
  ];


  var bundler = watchify(browserify(watchify.args)) 

  bundler.add(files);
  bundler.add('./lib/api.js', {expose: 'api'});
  bundler.require('./lib/api.js', {expose: 'api'});
  bundler.transform('reactify');
  bundler.on('update', rebundle);

  function rebundle() {
    bundler.plugin('factor-bundle', {
        outputs: [
          write('/path/to/file1.js'),
          write('/path/to/file2.js'),
          write('/path/to/file3.js'),
          ]
    });
    bundler.bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(write('shared.js'));
  };

  return rebundle();
}


function write (name) {
    return concat(function (content) {
        // create new vinyl file from content and use the basename of the
        // filepath in scope as its basename.
        return file(name, content, { src: true })
        // uglify content
        .pipe(uglify())
        // write content to build directory
        .pipe(gulp.dest('./public/bundles/'))
    });
}

It works fine but after five or ten rebundles I start seeing the following warning:

Trace
    at Browserify.addListener (events.js:179:15)
    at f (/Users/benoit/git/figure/web/node_modules/factor-bundle/index.js:55:7)
    at Browserify.plugin (/Users/benoit/git/figure/web/node_modules/browserify/index.js:345:9)
    at Browserify.bundle (/Users/benoit/git/figure/web/gulpfile.js:46:13)
    at Browserify.emit (events.js:107:17)
    at null._onTimeout (/Users/benoit/git/figure/web/node_modules/watchify/index.js:126:15)
    at Timer.listOnTimeout (timers.js:110:15)
(node) warning: possible EventEmitter memory leak detected. 11 finish listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at ConcatStream.addListener (events.js:179:15)
    at ConcatStream.once (events.js:204:8)
    at Labeled.Readable.pipe (/Users/benoit/git/figure/web/node_modules/factor-bundle/node_modules/labeled-stream-splicer/node_modules/stream-splicer/node_modules/readable-stream/lib/_stream_readable.js:612:8)
    at /Users/benoit/git/figure/web/node_modules/factor-bundle/index.js:73:43
    at Array.reduce (native)
    at Transform._flush (/Users/benoit/git/figure/web/node_modules/factor-bundle/index.js:65:35)
    at Transform.<anonymous> (/Users/benoit/git/figure/web/node_modules/factor-bundle/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:135:12)
    at Transform.g (events.js:199:16)
    at Transform.emit (events.js:129:20)
    at finishMaybe (/Users/benoit/git/figure/web/node_modules/factor-bundle/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:371:12)
    at endWritable (/Users/benoit/git/figure/web/node_modules/factor-bundle/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:378:3)
    at Transform.Writable.end (/Users/benoit/git/figure/web/node_modules/factor-bundle/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:356:5)
(node) warning: possible EventEmitter memory leak detected. 11 finish listeners added. Use emitter.setMaxListeners() to increase limit.
Lingua principale
JavaScript
Stelle
397
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di browserify/factor-bundle

Tutte le issue di browserify/factor-bundle

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.