Skip to content

Conversation

@ronag
Copy link
Member

@ronagronag commented Mar 19, 2020

stdio (stderr & stdout) should for compatibility
reasons not be closed/end():ed. However, this
causes pipeline with a stdio destination to
never finish. This commit fixes this issue at
a performance cost.

Refs: #7606

Fixes: #32363

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: nodejs#7606Fixes: nodejs#32363
@ronagronag requested a review from mcollinaMarch 19, 2020 21:41
@ronagronag added the stream Issues and PRs related to the stream subsystem. label Mar 19, 2020
@ronag
Copy link
MemberAuthor

ronag commented Mar 19, 2020

I'm not sure I understand/agree with not calling end() on stdio streams. However, this PR resolves the issue of pipeline not completing at a performance cost. This is the best solution I've found so far...

@ronag
Copy link
MemberAuthor

@vweevers

err ? reject(err) : resolve();
});
})
]);
Copy link
Member

Choose a reason for hiding this comment

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

It is likely faster to use the callbacks and manually handle everything. It could be wrapped in a single promise to allow to await the result for simplicity. Alternatively just also handle the finish call separately.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It is likely faster to use the callbacks and manually handle everything. It could be wrapped in a single promise to allow to await the result for simplicity

Yes, but that makes the implementation more complicated... at least as far as I can determine.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@ronagronag added the wip Issues and PRs that are still a work in progress. label Mar 19, 2020
@ronagronag removed the wip Issues and PRs that are still a work in progress. label Mar 19, 2020
@mcollina
Copy link
Member

What is the performance cost that you are mentioning?

@ronag
Copy link
MemberAuthor

ronag commented Mar 20, 2020

New information from @vweevers which might make this PR outdated.

Ah, my understanding of it was outdated. Since node v10.12.0 (see #23053 and ERR_STDOUT_CLOSE) you can indeed close these streams. Before they used to throw an error, now they allow it but "secretly" don't close the underlying fd.

@ronagronag added the wip Issues and PRs that are still a work in progress. label Mar 20, 2020
@ronag
Copy link
MemberAuthor

I'm putting this as blocked until we have gotten further clarification in the issue:

#32363

@ronagronag added the blocked PRs that are blocked by other issues or PRs. label Mar 20, 2020
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@ronagronag removed blocked PRs that are blocked by other issues or PRs. wip Issues and PRs that are still a work in progress. labels Apr 5, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
MemberAuthor

ronag commented Apr 6, 2020

@vweevers
Copy link
Contributor

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: + actual - expected + '"hello" \r\n' - 'hello\n' 

@ronag That's the behavior of echo "hello" on Windows, you'd get the same result with echo "hello" > test. I suggest removing the double quotes and trimming the result.

@ronag
Copy link
MemberAuthor

ronag commented Apr 6, 2020

@ronag That's the behavior of echo "hello" on Windows, you'd get the same result with echo "hello" > test. I suggest removing the double quotes and trimming the result.

So we expect different results on different platforms?

I suggest removing the double quotes and trimming the result.

I don't think that's enough, note the extra space and \r.

@nodejs-github-bot

This comment has been minimized.

@vweevers
Copy link
Contributor

vweevers commented Apr 6, 2020

The default newline on windows is \r\n. The extra space is because echo foo > test adds a space but echo foo> test does not. There are ways around this but normalizing such shell behaviors would not make this node.js test more meaningful.

@nodejsnodejs deleted a comment from nodejs-github-botApr 6, 2020
@nodejsnodejs deleted a comment from nodejs-github-botApr 6, 2020
@nodejs-github-bot
Copy link
Collaborator

@ronag
Copy link
MemberAuthor

ronag commented Apr 6, 2020

@mcollina@addaleax PTAL, made test compatible with Windows

Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

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

Still LGTM

ronag added a commit that referenced this pull request Apr 6, 2020
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
@ronag
Copy link
MemberAuthor

ronag commented Apr 6, 2020

Landed in 98b6b2d

@ronagronag closed this Apr 6, 2020
BethGriggs pushed a commit that referenced this pull request Apr 7, 2020
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
targos pushed a commit that referenced this pull request Apr 12, 2020
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
@targostargos mentioned this pull request Apr 13, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streamIssues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different behavior between transform function and async generator using pipelines

8 participants

@ronag@mcollina@nodejs-github-bot@vweevers@jasnell@addaleax@BridgeAR@targos