Skip to content
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

doc: stdout/stderr can block when directed to file #3170

Merged
merged 1 commit into from
Nov 5, 2015

Conversation

bnoordhuis
Copy link
Member

Update the documentation for process.stdout and process.stdout to
clarify that writes can block when stdio is redirected to a file. In
all other cases, it's non-blocking.

@bnoordhuis bnoordhuis added the doc Issues and PRs related to the documentations. label Oct 3, 2015
@bnoordhuis
Copy link
Member Author

For anyone wondering why stdio to file is a special case: asynchronous file writes need to be done from another thread. Applications that log a lot can easily overwhelm the thread pool.

@ChALkeR
Copy link
Member

ChALkeR commented Oct 4, 2015

@bnoordhuis

Applications that log a lot can easily overwhelm the thread pool.

See also #1741 — without redirecting, applications that log a lot can consume all the memory.

@bnoordhuis
Copy link
Member Author

Things get a lot worse when everything has to go through the thread pool first, though. Can I get a LGTM?

@mscdex mscdex added the process Issues and PRs related to the process subsystem. label Oct 6, 2015
@Fishrock123
Copy link
Contributor

Umm, can we at least list some cases when it does and doesn't block?

@bnoordhuis
Copy link
Member Author

I don't mind expanding if you can give me some pointers on what you want it to look like.

It's nuanced, though. Writes to a file don't normally block because of write-back caching, so you don't want to give off an impression that stdio-to-file is always bad.

@bnoordhuis
Copy link
Member Author

@Fishrock123 Ping?

@Fishrock123
Copy link
Contributor

Writes to a file don't normally block because of write-back caching, so you don't want to give off an impression that stdio-to-file is always bad.

Given this causes people grief time and again as seen by various issues, maybe you could add some info in like this?

When it blocks to regular terminal stdout or not is probably the most important, followed by redirected to a file. I think it's worth explaining in good detail here, if possible.

@bnoordhuis
Copy link
Member Author

@Fishrock123 Updated, PTAL.

@Fishrock123
Copy link
Contributor

Ugh, maybe my memory is failing but I thought it was blocking in more instances too? :/

otherwise LGTM.

Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: nodejs#3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@bnoordhuis bnoordhuis closed this Nov 5, 2015
@bnoordhuis bnoordhuis deleted the update-stdio-docs branch November 5, 2015 16:28
@bnoordhuis bnoordhuis merged commit dac1d38 into nodejs:master Nov 5, 2015
bnoordhuis added a commit that referenced this pull request Nov 7, 2015
Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: #3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@Fishrock123 Fishrock123 mentioned this pull request Nov 11, 2015
bnoordhuis added a commit that referenced this pull request Nov 16, 2015
Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: #3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@MylesBorins
Copy link
Contributor

landed in lts-v4.x-staging as 38a5ae1

bnoordhuis added a commit that referenced this pull request Dec 4, 2015
Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: #3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@jasnell jasnell mentioned this pull request Dec 17, 2015
bnoordhuis added a commit that referenced this pull request Dec 17, 2015
Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: #3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
bnoordhuis added a commit that referenced this pull request Dec 23, 2015
Update the documentation for `process.stdout` and `process.stdout` to
clarify that writes can block when stdio is redirected to a file.  In
all other cases, it's non-blocking.

PR-URL: #3170
Reviewed-By: Jeremiah Senkpiel <[email protected]>
orangejulius added a commit to pelias/fuzzy-tester that referenced this pull request Apr 4, 2016
`process.exit` quits immediately, without allowing buffered output from
say, a `console.log` to be printed. See these Node.js issues:

nodejs/node#3669
nodejs/node#3170
nodejs/node#2972 (comment)
orangejulius added a commit to pelias/schema that referenced this pull request Aug 4, 2016
`process.exit` can truncate long output in certain node versions, see
these tickets:

nodejs/node#3669
nodejs/node#3170
nodejs/node#2972 (comment)

fixes #161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants