| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@gibfahn this needs to go into node 8. |
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe the loop limit can be something like EventEmitter.defaultMaxListeners + 1 instead of a hardcoded value?
Sorry, something went wrong.
There was a problem hiding this comment.
updated
Sorry, something went wrong.
If the console destination is a unix pipe (net.Socket), write() is async. If the destination is broken, we are adding an 'error' event listener to avoid a process crash. This PR makes sure that we are adding that listener only once. Fixes: nodejs#16767
Sorry, something went wrong.
So this seems serious enough that it should go into the next Node 8.x release (planned for Tuesday). Thoughts @nodejs/lts? If so it'd be great to get this landed ASAP. |
Sorry, something went wrong.
|
@gibfahn I think it’s okay to include this in an LTS without letting it sit in a Current release, but tbh that’s more because of a low chance of breaking anything rather than any other reason. |
Sorry, something went wrong.
|
@addaleax do you think it's worth rushing the landing of this to get it into the next release? |
Sorry, something went wrong.
|
@gibfahn Can’t tell whether it’s worth it, but I think it’s the kind of bugfix that shouldn’t need to wait 4 weeks to be fixed due to process… |
Sorry, something went wrong.
|
I think it should go in 8 asap. As @addaleax said, this is a low risk change. When is the next release planned? |
Sorry, something went wrong.
Sorry, something went wrong.
|
And after that? |
Sorry, something went wrong.
|
Are we ok to fast-track this? cc @nodejs/tsc |
Sorry, something went wrong.
Probably another couple of weeks. |
Sorry, something went wrong.
|
Can this code get confused if the end-user adds an error handler, and then later removes it? That is, the error handler count is greater than 0, but only briefly? |
Sorry, something went wrong.
|
Definitely good with getting this landed quickly. It's likely safe to let it stand for a week or two before landing in LTS. |
Sorry, something went wrong.
no. Emitting 'error' is done only once, and it is just deferred to the next tick: https://github.com/nodejs/node/blob/master/lib/_stream_writable.js#L398. This condition happens only when _writev is involved, as multiple writes are going to error at the same time. |
Sorry, something went wrong.
| // from becoming an uncaught exception, but since the handler is | ||
| // removed after the event, non-console.* writes won’t be affected. | ||
| stream.once('error', noop); | ||
| // we are only adding noop if there is no one else listening for 'error' |
There was a problem hiding this comment.
if this can happen only with writev(), its worth mentioning specifically in the comment
Sorry, something went wrong.
If the console destination is a unix pipe (net.Socket), write() is async. If the destination is broken, we are adding an 'error' event listener to avoid a process crash. This PR makes sure that we are adding that listener only once. Fixes: #16767 PR-URL: #16770 Fixes: #16767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
If the console destination is a unix pipe (net.Socket), write() is async. If the destination is broken, we are adding an 'error' event listener to avoid a process crash. This PR makes sure that we are adding that listener only once. Fixes: #16767 PR-URL: #16770 Fixes: #16767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
If the console destination is a unix pipe (net.Socket), write() is async. If the destination is broken, we are adding an 'error' event listener to avoid a process crash. This PR makes sure that we are adding that listener only once. Fixes: #16767 PR-URL: #16770 Fixes: #16767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Notable Changes: - **console**: - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n de/pull/16770) - **http2**: - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej s/node/pull/16718) PR-URL: #17204
Notable Changes: - **console**: - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n de/pull/16770) - **http2**: - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej s/node/pull/16718) PR-URL: #17204
| Back | FazBrowse Home | New Git URL |
If the console destination is a unix pipe (net.Socket), write() is
async. If the destination is broken, we are adding an 'error' event
listener to avoid a process crash. This PR makes sure that we are adding
that listener only once.
Fixes: #16767
Checklist
Affected core subsystem(s)
console