-
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
Setting callback for on 'data' event of stderr causes error on v10.0.0 #21203
Comments
Okay, it doesn't throw on Node 8 and throws on 10. /cc @nodejs/process @nodejs/streams |
Even if it's a valid error, we should try throwing something descriptive. |
This is likely a bug on stdout/stderr and net, and not on stream. |
I git bisected when the error was introduced, if that helps (this commit):
|
The specific commit in libuv responsible for this is libuv/libuv@8f9ba2a. Specifically, the This breakage was not intended, but this is arguably a bug in Node (or the application code) as the socket's |
Hi All, would like to work on this need some guidance, as per comments i think this hasn't been fixed yet please let me know if this still need to fixed for me to proceed :) |
Same issue exists with v10.5.0 and process.stdout.on('data', function(data) {
}); |
Resolving issue is more complicated than it seemed at first glance(atleast to me), but the gist of the issue is is the Relevant code is at: node/lib/internal/process/stdio.js Lines 164 to 197 in cdb5985
|
V
…On Sun, Jun 24, 2018, 5:08 PM Ayush Gupta ***@***.***> wrote:
Found the issue, PR coming in a bit if the fix works.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21203 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEvYgA23bcuvV_aHIdWKVgiYpePFDMAvks5t_3o_gaJpZM4UfUp1>
.
|
I guess this is the relevant code, for a top level Node process (stdout / err is a TTY): Lines 82 to 86 in 831821b
While I think this is a design decision rather than a bug, the ask in the first comment looks like valid requirement to me, at least allowing stdio to be readable - absorbing stdio logs without allowing the write onto the actual device (don't know if it is possible though) can be useful for custom redirections without code modifications. |
I'm proposing #21654 as a fix for this to be landed in master and Node 10. Then we might want to change this behavior in Node 11 to produce an explicative error. |
This change avoid an 'read ENOTCONN' error introduced by libuv 1.20.0 when trying to read from a TTY WriteStream. Instead, we are throwing a more actionable ERR_TTY_WRITABLE_NOT_READABLE. Fixes: nodejs#21203
I’m reopening this since #22997 should be a good step towards making this work again |
This reverts commit 91eec00. Refs: nodejs#21654 Refs: nodejs#21203
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: nodejs#21203
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: #21203 PR-URL: #23053 Reviewed-By: James M Snell <jasnell@gmail.com>
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: #21203 PR-URL: #23053 Reviewed-By: James M Snell <jasnell@gmail.com>
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: #21203 PR-URL: #23053 Reviewed-By: James M Snell <jasnell@gmail.com>
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: #21203 Backport-PR-URL: #25351 PR-URL: #23053 Reviewed-By: James M Snell <jasnell@gmail.com>
…1063) (close: #1064) Refs: - nodejs/node#21203 - nodejs/node@cbc3ef6
…1063) (close: #1064) Refs: - nodejs/node#21203 - nodejs/node@cbc3ef6
I am a bit confused on what was the solution for this one (fixed or it still throws error but in another way?). In my project these lines of code exist for redirecting stderr to syslogger
This triggers uncaughtException listener always with
Whatever the callback is, exception is thrown. |
Allow reading from stdio streams that are conventionally associated with process output, since this is only convention. This involves disabling the oddness around closing stdio streams. Its purpose is to prevent the file descriptors 0 through 2 from being closed, since doing so can lead to information leaks when new file descriptors are being opened; instead, not doing anything seems like a more reasonable choice. Fixes: nodejs/node#21203 PR-URL: nodejs/node#23053 Reviewed-By: James M Snell <jasnell@gmail.com>
I am unable to set a callback on the 'data' event (since
process.stderr
is anet.Socket
stream, it should emit thedata
event).The following snippet works on v8.0.0 but throws an error on v10.0.0:
Error threw:
The text was updated successfully, but these errors were encountered: