Skip to content

Conversation

kalenikalexander
Copy link

@kalenikalexander kalenikalexander commented Jan 4, 2021

Fixes: #36674
Refs: #29227 (comment)

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included

pipeline([r, t, w], common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_STREAM_DESTROYED');
assert.strictEqual(err.message,
'Cannot call write after a stream was destroyed');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the error message more helpful? E.g.: Cannot call write after a 2 stream in pipeline() was destroyed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it doesn't make sense since ERR_STREAM_DESTROYED will cause 2 stream to be destroyed because destination stream is passed in destroyed state -- opposite logic here. Also I am not sure if pipeline really need to be mentioned in error message.

Copy link
Author

@kalenikalexander kalenikalexander Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First destroyed stream in passed arguments should cause all previous streams in pipe chain to be destroyed

Copy link

@misos1 misos1 May 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only previous streams? All streams should be destroyed like what will happen when some stream is destroyed during pipeline processing.

@kalenikalexander kalenikalexander force-pushed the pipeline-error-if-any-stream-is-destroyed branch from d6ed804 to bd4d601 Compare January 5, 2021 04:37
@targos targos added the stream Issues and PRs related to the stream subsystem. label Jan 5, 2021
@targos
Copy link
Member

targos commented Jan 5, 2021

@nodejs/streams

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2021
@aduh95 aduh95 added the review wanted PRs that need reviews. label Jan 18, 2021
@mcollina
Copy link
Member

I'm sorry this slipped through my notification stream.

@ronag wdyt?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, seems good.

@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

Can you please rebase on top of master? Apparently something went wrong with the github merge I did.

}

if (isStream(ret) && ret.destroyed) {
finish(new ERR_STREAM_DESTROYED(reading ? 'pipe' : 'write'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not ERR_STREAM_PREMATURE_CLOSE so it would be consistent with what will happen when the stream is destroyed during pipeline?

@ronag ronag added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 8, 2021
}

if (isStream(ret) && ret.destroyed) {
finish(new ERR_STREAM_DESTROYED(reading ? 'pipe' : 'write'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a throw?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would be good if used the isDestroyed stream utility function.

@ronag
Copy link
Member

ronag commented Jul 8, 2021

@kalenikalexander You still interested in finishing this one? Sorry it slipped my notifications.

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2021
@nodejs-github-bot
Copy link
Collaborator

@targos targos removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 11, 2021
@ronag ronag closed this Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review wanted PRs that need reviews. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream: pipeline should error if any stream is destroyed

8 participants