| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
| const server = http.createServer(common.mustNotCall((req, res) => { | |
| })); | |
| const server = http.createServer(common.mustNotCall()); |
Sorry, something went wrong.
There was a problem hiding this comment.
| Passing an `AbortSignal` and then calling `abort` on the corrosponding | |
| Passing an `AbortSignal` and then calling `abort` on the corresponding |
Sorry, something went wrong.
There was a problem hiding this comment.
Nit: perhaps use once here as well ({ once: true })?
Sorry, something went wrong.
There was a problem hiding this comment.
I feel like it would be more hacky since we're removing the listener below even if it is invoked since close should be fired.
If I pass once and someone abortss the controller - the signal will fire abort, the listener will be removed, then close will fire and we will try removing a non-existing listener which will technically be no harm but will be slightly confusing.
Sorry, something went wrong.
There was a problem hiding this comment.
| pr-url: https://github.com/nodejs/node/pull/319999 | |
| pr-url: https://github.com/nodejs/node/pull/36048 |
Sorry, something went wrong.
There was a problem hiding this comment.
| // destroy with AbortSignal | |
| // Destroy with AbortSignal |
Sorry, something went wrong.
There was a problem hiding this comment.
| `AbortConttoller` will behave the same way as calling `.destroy()` on the | |
| `AbortController` will behave the same way as calling `.destroy()` on the |
Sorry, something went wrong.
There was a problem hiding this comment.
Should we extract the value in a variable to be safe? Options could be changed later or the property could be a getter that throws afterwards
Sorry, something went wrong.
There was a problem hiding this comment.
I would call .destroy() with an error.
Sorry, something went wrong.
There was a problem hiding this comment.
I... think you're right. If cancellation is abnormal elsewhere it should likely be abnormal termination here and abort with an AbortError with a .code
Sorry, something went wrong.
There was a problem hiding this comment.
I... think I changed my mind again. Lol, I think calling .destroy without an error is probably right and the error the user is getting should probably be ECONNRESET and not an AbortError anyway.
I'd rather users get consistent errors on request aborts than always getting AbortErrors consistent errors when using AbortController.
I'm really not sure here tbh.
Sorry, something went wrong.
There was a problem hiding this comment.
cc @ronag
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think it will ECONNRESET if aborted before a socket is assigned.
Sorry, something went wrong.
There was a problem hiding this comment.
@ronag it does (there is a test for it)
Sorry, something went wrong.
There was a problem hiding this comment.
cc @jasnell
Sorry, something went wrong.
There was a problem hiding this comment.
This is a bit weird to me... if we are going to do this isn't it better to just add signal support generically to streams?
I don't really see the point of this since streams have .destroy().
Sorry, something went wrong.
@ronag even if http.request returns a stream and we make those cancelable with signals, it should still take a signal as a parameter for ownership. If we make stream.Readable cancellable with signals through a AbortSignal known symbol property or constructor parameter that would be useful but not help in this case since the stream isn't constructed by the user - it's just returned to the caller. Allowing users to destroy an http.request (and other streams) by passing in a signal is very useful ergonomics wise. It's the same way users cancel other things (like timers) and the standard web platform cancellation mechanism. |
Sorry, something went wrong.
I don't quite see if but don't have a strong opinion. However, I do think if we do this we should do it on the streams level. |
Sorry, something went wrong.
|
I will follow up with a PR for readable Edit: very much wip @ronag https://github.com/nodejs/node/compare/master...benjamingr:abort-signal-stream?expand=1 will make a PR sometime this week hopefully |
Sorry, something went wrong.
Sorry, something went wrong.
|
Why not have this PR also destroy with lazyDOMException('The operation was aborted', 'AbortError')? |
Sorry, something went wrong.
|
@ronag I think users would probably expect an ECONNRESET - no? |
Sorry, something went wrong.
Sorry, something went wrong.
Not necessarily. What about the case when aborting before 'socket'? I would not expect a ECONNRESET then. I don't have a strong opinion. |
Sorry, something went wrong.
|
@ronag the test here aborts synchronously, that is before socket iiuc. Note I am not sure what's the right thing either - and also in http2, I don't understand the implications of why aborting with an error here would matter so if there is a good reason to .destroy with an error here (and in HTTP2) please let me know :] My involvement in the project and willingness to do the work does not excuse my ignorance in this case. So if I'm missing something please let me know. (The more general AbortSignal for Readable will .destroy with an error) |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #36048 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- Builds on nodejs#36048 and nodejs#36084 - Modify test to verify this fact
PR-URL: #36048 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
PR-URL: nodejs#36048 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
| Back | FazBrowse Home | New Git URL |
cc @mcollina @jasnell @addaleax
This is the last one from #35877 (comment) - if you have any more APIs you want me to add support for AbortSignal in before I go back to that list I started making back then please let me know :]
Also we should talk about streams and this probably.
Checklist