Uh oh!
There was an error while loading. Please reload this page.
doc: stdout/stderr can block when directed to file - #3170
Conversation
bnoordhuis
commented
Oct 3, 2015
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
commented
Oct 4, 2015
See also #1741 — without redirecting, applications that log a lot can consume all the memory. |
bnoordhuis
commented
Oct 4, 2015
Things get a lot worse when everything has to go through the thread pool first, though. Can I get a LGTM? |
Fishrock123
commented
Oct 7, 2015
Umm, can we at least list some cases when it does and doesn't block? |
bnoordhuis
commented
Oct 7, 2015
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
commented
Oct 14, 2015
@Fishrock123 Ping? |
Fishrock123
commented
Oct 14, 2015
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. |
beb3f0f to
7947b6cComparebnoordhuis
commented
Nov 5, 2015
@Fishrock123 Updated, PTAL. |
Fishrock123
commented
Nov 5, 2015
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 <fishrock123@rocketmail.com>
7947b6c to
dac1d38CompareUpdate 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 <fishrock123@rocketmail.com>
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 <fishrock123@rocketmail.com>
MylesBorins
commented
Nov 16, 2015
landed in lts-v4.x-staging as 38a5ae1 |
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 <fishrock123@rocketmail.com>
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 <fishrock123@rocketmail.com>
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 <fishrock123@rocketmail.com>
`process.exit` quits immediately, without allowing buffered output from say, a `console.log` to be printed. See these Node.js issues: nodejs/node#3669nodejs/node#3170nodejs/node#2972 (comment)
`process.exit` can truncate long output in certain node versions, see these tickets: nodejs/node#3669nodejs/node#3170nodejs/node#2972 (comment)fixes#161
Update the documentation for
process.stdoutandprocess.stdouttoclarify that writes can block when stdio is redirected to a file. In
all other cases, it's non-blocking.