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

streams: fix regression in `unpipe()` #9171

Closed
wants to merge 3 commits into
base: master
from

Conversation

@addaleax
Member

addaleax commented Oct 18, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

Description of change

Since 2e568d9 there is a bug where unpiping a stream from a readable stream that has _readableState.pipesCount > 1 will cause it to remove the first stream in the _.readableState.pipes array no matter where in the list the dest stream was.

This patch corrects that problem.

Credit for the bug report and the test case go to @niels4. Since it’s a rather big bug, I’ve opened a PR myself. (If you let me know an email address/name in time, I can add you as the git author of the test file.)

Fixes: #9170

@evanlucas

LGTM

@addaleax

This comment has been minimized.

Show comment
Hide comment
Member

addaleax commented Oct 18, 2016

@niels4

This comment has been minimized.

Show comment
Hide comment
@niels4

niels4 Oct 18, 2016

Thanks for getting this started. I was just finishing a meeting and then it took me a little bit to figure out where to put the test.

I took some time to change the test case to look similar to the other tests already in place (this one doesn't refer directly to _readableState). Looks like you already have this pull request started, but my changes can be found in this commit
niels4@bc88190

My name is Niels Nielsen, email niels@protectwise.com

niels4 commented Oct 18, 2016

Thanks for getting this started. I was just finishing a meeting and then it took me a little bit to figure out where to put the test.

I took some time to change the test case to look similar to the other tests already in place (this one doesn't refer directly to _readableState). Looks like you already have this pull request started, but my changes can be found in this commit
niels4@bc88190

My name is Niels Nielsen, email niels@protectwise.com

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Oct 18, 2016

Member

@niels4 awesome, I’ve updated the PR with bits from your change + set you as the author here

Member

addaleax commented Oct 18, 2016

@niels4 awesome, I’ve updated the PR with bits from your change + set you as the author here

addaleax and others added some commits Oct 18, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

Fixes: #9170
test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.
source.pipe(dest1);
source.pipe(dest2);

This comment has been minimized.

@lpinca

lpinca Oct 18, 2016

Member

Nit: probably unrelated but maybe it makes sense to assert that source._readableState.pipes contains both dest1 and dest2 now.

@lpinca

lpinca Oct 18, 2016

Member

Nit: probably unrelated but maybe it makes sense to assert that source._readableState.pipes contains both dest1 and dest2 now.

This comment has been minimized.

@addaleax
@addaleax

addaleax Oct 18, 2016

Member

@lpinca done

@lpinca

lpinca approved these changes Oct 18, 2016

LGTM

@mscdex mscdex added the stream label Oct 18, 2016

@mscdex mscdex referenced this pull request Oct 18, 2016

Closed

Bot failed to label PR #86

@jasnell

LGTM

@jasnell jasnell added this to the 7.0.0 milestone Oct 18, 2016

@addaleax

This comment has been minimized.

Show comment
Hide comment
Member

addaleax commented Oct 19, 2016

@mcollina

LGTM

@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins
Member

MylesBorins commented Oct 19, 2016

LGTM

@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins

MylesBorins Oct 19, 2016

Member

freebsd 11 stalled, arm7 wheezy and smart os 14 never started

smart os 15 fails are all known flakes

There are two freebsd10 failures related to timers, I do not think they are related to this change

I'm going to go ahead and land the change as this is a pretty big break.

Member

MylesBorins commented Oct 19, 2016

freebsd 11 stalled, arm7 wheezy and smart os 14 never started

smart os 15 fails are all known flakes

There are two freebsd10 failures related to timers, I do not think they are related to this change

I'm going to go ahead and land the change as this is a pretty big break.

@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins

MylesBorins Oct 19, 2016

Member

landed in bb173f9...92ece86

edit: backported to v7.x-staging and v6.x-staging. release coming soon

Member

MylesBorins commented Oct 19, 2016

landed in bb173f9...92ece86

edit: backported to v7.x-staging and v6.x-staging. release coming soon

MylesBorins added a commit that referenced this pull request Oct 19, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

PR-URL: #9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

PR-URL: #9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

PR-URL: #9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Oct 19, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

PR-URL: #9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

@MylesBorins MylesBorins referenced this pull request Oct 19, 2016

Merged

V6.9.1 proposal #9186

@addaleax addaleax referenced this pull request Oct 19, 2016

Merged

meta: remove let from for loops #8873

2 of 2 tasks complete

@MylesBorins MylesBorins referenced this pull request Nov 11, 2016

Closed

Backport removing let in for loop declaration #9553

3 of 3 tasks complete

MylesBorins added a commit to MylesBorins/node that referenced this pull request Nov 11, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

Ref: nodejs#9553
PR-URL: nodejs#9171
Fixes: nodejs#9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit to MylesBorins/node that referenced this pull request Nov 11, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

Ref: nodejs#9553
PR-URL: nodejs#9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Nov 14, 2016

streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

This patch corrects that problem.

Ref: #9553
PR-URL: #9171
Fixes: #9170
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

MylesBorins added a commit that referenced this pull request Nov 14, 2016

test: add regression test for `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream
from a readable stream that has `_readableState.pipesCount > 1`
will cause it to remove the first stream in the
`_.readableState.pipes` array no matter where in the list the
`dest` stream was.

Ref: #9553
PR-URL: #9171
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>

@MylesBorins MylesBorins referenced this pull request Nov 22, 2016

Merged

v4.7.0 proposal #9736

@addaleax addaleax deleted the addaleax:fix-stream-unpipe-regression branch Dec 6, 2016

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