Sitelet https://github.com/nodejs/node/issues/2655
Skip to content

can't pipe to a stream without listenerCount #2655

Description

@calvinmetcalf

just noticed this when looking into upgrading readable stream to v3.3.0

Activity

  1. added
    streamIssues and PRs related to Node.js streams.
    on Sep 2, 2015
  2. added this to the 4.0.0 milestone on Sep 2, 2015
  3. self-assigned this
    on Sep 2, 2015
  4. Fishrock123 commented on Sep 2, 2015

    @Fishrock123
    Contributor

    Was introduced in 8f58fb9. I'm on it.

  5. thefourtheye commented on Sep 2, 2015

    @thefourtheye
    Contributor

    @calvinmetcalf Can you please explain with a small program to reproduce the problem?

  6. Fishrock123 commented on Sep 2, 2015

    @Fishrock123
    Contributor

    @calvinmetcalf I understand the gist of the issue, but I can't seem to reproduce it with this?

    'use strict';
    var common = require('../common');
    var stream = require('stream');
    
    const r = new stream.Stream();
    r.listenerCount = undefined;
    
    const w = new stream.Stream();
    w.listenerCount = undefined;
    
    w.on('pipe', function() {
      r.emit('error', new Error('Readable Error'));
      w.emit('error', new Error('Writable Error'));
    });
    r.pipe(w);

    To my understanding that should cause this error?

    EDIT: fixed.

  7. Fishrock123 commented on Sep 2, 2015

    @Fishrock123
    Contributor

    Does this only show up when using custom event-emitter solutions?

  8. thefourtheye commented on Sep 2, 2015

    @thefourtheye
    Contributor

    @Fishrock123 You had to pipe it after attaching the handler ;-)

    'use strict';
    var stream = require('stream');
    
    const r = new stream.Stream();
    r.listenerCount = undefined;
    
    const w = new stream.Stream();
    w.listenerCount = undefined;
    
    w.on('pipe', function() {
      r.emit('error', new Error('Readable Error'));
    });
    
    r.pipe(w);

    Also, thanks for helping me understand the problem :-)

  9. Fishrock123 commented on Sep 3, 2015

    @Fishrock123
    Contributor

    Fixed in b513a33

    @calvinmetcalf if you could confirm, that'd be 💯

  10. calvinmetcalf commented on Sep 4, 2015

    @calvinmetcalf
    ContributorAuthor

    will look in the morning thanks!

  11. calvinmetcalf commented on Sep 4, 2015

    @calvinmetcalf
    ContributorAuthor

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

streamIssues and PRs related to Node.js streams.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions