doc: warn against streaming from character devices#21212
doc: warn against streaming from character devices#21212gireeshpunathil wants to merge 2 commits intonodejs:masterfrom
Conversation
doc/api/fs.md
Outdated
|
@nodejs/fs @nodejs/documentation |
doc/api/fs.md
Outdated
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
@vsemozhetbyt - split it for more clarity, ptal.
There was a problem hiding this comment.
"fd" should be in backticks, I think. (Can go either way, but for consistency with the previous paragraph, for example.)
You can probably drop Also note that.
Trott
left a comment
There was a problem hiding this comment.
Just putting a 'request changes' here to make sure this doesn't land without @vsemozhetbyt's comment being addressed. If the comment gets addressed, feel free to dismiss this review.
15a20ac to
d0aa7ed
Compare
doc/api/fs.md
Outdated
There was a problem hiding this comment.
stream.close() -> `stream.close()`?
doc/api/fs.md
Outdated
There was a problem hiding this comment.
stream.close() -> `stream.close()`?
2448d2d to
040f3d5
Compare
|
@vsemozhetbyt - thanks, nits addressed. |
doc/api/fs.md
Outdated
There was a problem hiding this comment.
I don't think "epitomize" is a word most non-english speakers will know.
There was a problem hiding this comment.
please suggest alternative, if you know.
There was a problem hiding this comment.
just endless streams straight up? i don't personally know what epitomize mean
There was a problem hiding this comment.
changed the wording from epitomize to exemplifies
doc/api/fs.md
Outdated
There was a problem hiding this comment.
I'm not sure I follow this last sentence.
There was a problem hiding this comment.
the problem with character device when abstracted as streams in Node is that they operate on a blocking file descriptor, managed by pooled worker threads, with a passback async handle to the main thread. so once they engage in reading, there is no way to unblock the thread, other than passing a dummy character to 'unblock' the reader thread, close the libuv handles and disengage from further reading.
There was a problem hiding this comment.
Is that something you can do with the fs api here? An example might work to reduce confusion :)
There was a problem hiding this comment.
added an example
f48adc2 to
f1f4dfc
Compare
doc/api/fs.md
Outdated
There was a problem hiding this comment.
Nit: it seems we usually start comments with an uppercase letter and end them with a period.
58c22ab to
fc01bd8
Compare
reason for this change request was addressed, hence dismissing
|
@mafintosh @Trott - all comments were addressed, PTAL. thanks. |
|
ping @mafintosh @Trott |
doc/api/fs.md
Outdated
doc/api/fs.md
Outdated
|
Left some non-blocking nits. I'm fine with this landing, but am not leaving an approval because the behavior described is not something I'm familiar with. I trust that it is being accurately described, though. |
charcter device streaming works just like any other streams, but hangs on the close callsite due to the worker thread being blocked on the read and main thread waiting for any async event that may not occur. Document this behavior and suggest a potential workaround. Fixes: nodejs#15439
fc01bd8 to
9226e41
Compare
|
thanks @Trott , I have addressed all your comments. |
|
landed as 66e6d78 |
charcter device streaming works just like any other streams, but hangs on the close callsite due to the worker thread being blocked on the read and main thread waiting for any async event that may not occur. Document this behavior and suggest a potential workaround. Fixes: #15439 PR-URL: #21212 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The text contained a number of inaccuracies: - The main thread is never blocked by a stream close. - There is no such thing as an EOF character on the OS level, the libuv level, or the Node.js stream level. - These streams *do* respond to `.close()`, but pending reads can delay this indefinitely. - Pushing a random character into the stream works only when the source data can be controlled; Using the JS `.push()` method is something different, and does not “unblock” any threads. Refs: nodejs#21212
charcter device streaming works just like any other streams, but hangs on the close callsite due to the worker thread being blocked on the read and main thread waiting for any async event that may not occur. Document this behavior and suggest a potential workaround. Fixes: #15439 PR-URL: #21212 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The text contained a number of inaccuracies: - The main thread is never blocked by a stream close. - There is no such thing as an EOF character on the OS level, the libuv level, or the Node.js stream level. - These streams *do* respond to `.close()`, but pending reads can delay this indefinitely. - Pushing a random character into the stream works only when the source data can be controlled; Using the JS `.push()` method is something different, and does not “unblock” any threads. Refs: #21212 PR-URL: #22569 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The text contained a number of inaccuracies: - The main thread is never blocked by a stream close. - There is no such thing as an EOF character on the OS level, the libuv level, or the Node.js stream level. - These streams *do* respond to `.close()`, but pending reads can delay this indefinitely. - Pushing a random character into the stream works only when the source data can be controlled; Using the JS `.push()` method is something different, and does not “unblock” any threads. Refs: #21212 PR-URL: #22569 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
charcter device streaming works just like any other streams, but hangs on the close callsite due to the worker thread being blocked on the read and main thread waiting for any async event that may not occur. Document this behavior and suggest a potential workaround. Fixes: #15439 PR-URL: #21212 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The text contained a number of inaccuracies: - The main thread is never blocked by a stream close. - There is no such thing as an EOF character on the OS level, the libuv level, or the Node.js stream level. - These streams *do* respond to `.close()`, but pending reads can delay this indefinitely. - Pushing a random character into the stream works only when the source data can be controlled; Using the JS `.push()` method is something different, and does not “unblock” any threads. Refs: #21212 PR-URL: #22569 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
charcter device streaming works just like any other streams, but hangs on the close callsite due to the worker thread being blocked on the read and main thread waiting for any async event that may not occur. Document this behavior and suggest a potential workaround. Fixes: #15439 PR-URL: #21212 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
The text contained a number of inaccuracies: - The main thread is never blocked by a stream close. - There is no such thing as an EOF character on the OS level, the libuv level, or the Node.js stream level. - These streams *do* respond to `.close()`, but pending reads can delay this indefinitely. - Pushing a random character into the stream works only when the source data can be controlled; Using the JS `.push()` method is something different, and does not “unblock” any threads. Refs: #21212 PR-URL: #22569 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
charcter device streaming works just like any other streams, but hangs
on the close callsite due to the worker thread being blocked on the read
and main thread waiting for any async event that may not occur.
Document this behavior and suggest a potential workaround.
Fixes: #15439
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes