-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: fix up warning text about character devices #22569
Conversation
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
@addaleax - thanks for the rework. I am not fully aligned to your PR description, but the doc change is much more crisp and cleaner than mine, so I am good here. The inner details of what is happening at the thread and descriptor level is here: #15439 (comment) in case if you haven't already seen that. |
@gireeshpunathil You can feel free to point out if I’m mistaken about anything. Regarding your linked comment:
That issue pops up when we exhaust the thread pool, or when we try to exit the process (which involves waiting for all threads on POSIX systems), but before that the main thread should be unaffected? |
this is how I visualized the issue:
EOF: character devices differ from block devices (such as files) in that the later issue a special character that causes the |
I guess that’s right, but we don’t usually refer to this as the main thread being blocked when it’s waiting for something to happen (but rather when it cannot get to the state of waiting for something to happen), do we? And for the EOF character – that might be OS-dependent, but whether or not a special character is used on the hardware level is transparent to everything provided from the syscall level and upward, so it’s probably not a topic for our own docs? |
agreed to both your points, thanks! |
Landed in f2338ed |
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>
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>
The text contained a number of inaccuracies:
the libuv level, or the Node.js stream level.
.close()
, but pendingreads can delay this indefinitely.
the source data can be controlled; Using the JS
.push()
method is something different, and does not “unblock” any threads.
Refs: #21212
Pinging previous reviewers: @gireeshpunathil @vsemozhetbyt @jasnell @trivikr
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes