Uh oh!
There was an error while loading. Please reload this page.
child_process: support Symbol.dispose - #48551
Conversation
Symbol.asyncDestroySymbol.asyncDisposeThere was a problem hiding this comment.
What if the user remove all exit event handlers?
ronag
left a comment
There was a problem hiding this comment.
Isn't this changing a little too much? I think this PR could be more minimal.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ronag
left a comment
There was a problem hiding this comment.
I'm unsure whether it's sufficient to wait for 'exit' or 'close' is the more correct event to wait for? Not sure exactly what the difference is between these two.
Let's add a ChildProcess.prototype[SymbolAsyncDispose]=asyncfunction(){if(!this.closed){awaitEE.once(this,'close');}}; |
MoLow
commented
Jul 2, 2023
according to the code, |
MoLow
commented
Jul 2, 2023
we cannot use |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Why this? Not saying I disagree. Just not sure whether I do agree. @benjamingr any thoughts?
There was a problem hiding this comment.
So other consumers of the child process know it was aborted. this is the same behavior we've implemented on Readable[Symbol.asyncDispose]
There was a problem hiding this comment.
There is a race here though. The process might still exit successfully.
There was a problem hiding this comment.
I am Not sure I follow. can you provide an example?
There was a problem hiding this comment.
The process can succeed before it receives the kill. In which case you are emitting a bad error.
There was a problem hiding this comment.
An abortion is just a hint. The process may still choose to fully complete.
There was a problem hiding this comment.
I think this quickly becomes complicated. I'd prefer not to emit any error here.
There was a problem hiding this comment.
it can be a surprising behavior for a child process to exit without a kill signal and a code, and with incomplete stdout/stderr
There was a problem hiding this comment.
Let's ask for @ronbuckton 's advice:
The question here is:
awaitusingcp=childProcess1;// someOtherCodedoSomethingWith(childProcess1);What should the behavior be from doSomethingWith's side? For example if someone is reading stdout while another consumer is disposing it should it error?
ronag
commented
Jul 2, 2023
Any signal other than SIGKILL may actually be ignored by the process. Which would lead to a deadlock in our case. |
MoLow
commented
Jul 2, 2023
a pending promise is not a deadlock |
ronag
commented
Jul 2, 2023
It is if you wait for it, expecting it to resolve and it never does |
ronag
commented
Jul 2, 2023
I'd like to have some more opinions on this. I feel there is a risk of this being an anti-pattern that we encourage. |
ronag
commented
Jul 3, 2023
Maybe we can get around the deadlock issue by always having a timeout which eventually calls sigkill and makes sure the promise will eventually resolve. |
benjamingr
commented
Jul 3, 2023
An alternative is to implement |
benjamingr
commented
Jul 4, 2023
I think this is the only reasonable option given we don't know how to wait for the process to terminate "for sure" |
Uh oh!
There was an error while loading. Please reload this page.
Symbol.asyncDisposeSymbol.disposenodejs-github-bot
commented
Jul 5, 2023
nodejs-github-bot
commented
Jul 5, 2023
nodejs-github-bot
commented
Jul 5, 2023
Landed in 773fde2 |
PR-URL: #48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #48551 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
No description provided.