| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@gireeshpunathil sadly an error occured when I tried to trigger a build :( |
Sorry, something went wrong.
|
Why is this dependent on __POSIX__ or Node being a shared library? Also: Do we want to enable breaking out of the currently execution JS code? It might be nice to work towards something similar to Worker::Exit()… |
Sorry, something went wrong.
|
@addaleax - thanks for the review.
On an assumptions that (a) only embedders need this feature, (b) embedders always use or want to use node as a shared library, and (c) the shared library is only available on POSIX platforms. Reviewing the code, at least (c) is not true, but unsure on (a) and (b). What do you propose? opening this up on the regular path has the side effect of hosting an extra async handle in the event loop all the time. But your below suggestion may invalidate that I guess?
Sure, thanks - I will see that. |
Sorry, something went wrong.
|
@gireeshpunathil b) isn’t true either. If you’re an embedder, at this point you’re most likely compiling a custom version of node yourself and linking it statically (e.g. electron). I don’t know about a), but then again I’m not sure we need to restrict it to that? |
Sorry, something went wrong.
|
@addaleax - thanks for the guidance, let me go back and do more study on this - to set the semantic straight. |
Sorry, something went wrong.
|
@gireeshpunathil Thinking about it a bit more … right now, the event loop stopping mechanism for workers piggybacks on the message passing mechanism, grep around for e.g. stop_event_loop_. Maybe refactoring that into its own uv_async_t/HandleWrap would be a good start, so that we could reuse it for the main loop? |
Sorry, something went wrong.
|
@addaleax - some gaps in my understanding, please help with fill those:
Please let me know. |
Sorry, something went wrong.
|
What's the status on this one? |
Sorry, something went wrong.
|
@jasnell - some open questions that I will need to find answers. stalled label looks good for now. |
Sorry, something went wrong.
|
I was looking at the possibility of uv_stop semantics to force-close the loop, but realized it is not possible: The main loop never shuts down while there are active handles in it. Lines 794 to 797 in 7182aca Workers indeed breaks out fully; but leaves the handles open: Lines 206 to 214 in 7182aca So in effect:
may be we should revisit uv_walk and uv_xx_close or uv_stop followed by uv_close ? the former was earlier assessed to be unsafe. |
Sorry, something went wrong.
|
@gireeshpunathil What do you mean by handle leak? All handles associated with an Environment are cleaned up when the Environment is released, so that should be okay, right? |
Sorry, something went wrong.
|
@addaleax - o, yes. I see! So that means the only issue is to gracefully shutdown the main loop. In theory, we can exit if we use a flag that the stopper thread sets, and the main thread sees in the run loop to break out. But may be there is a better way? |
Sorry, something went wrong.
|
@gireeshpunathil I still think refactoring out the approach we currently use for Workers is the best way here (I think I mentioned that above); we use a combination of an uv_async_t, whose handler calls uv_stop(), and isolate->TerminateExecution(). |
Sorry, something went wrong.
|
sure @addaleax, will give it a try |
Sorry, something went wrong.
|
Just a note that this is waiting on #26099 |
Sorry, something went wrong.
The current mechanism of uses two async handles, one owned by the creator of the worker thread to terminate a running worker, and another one employed by the worker to interrupt its creator on its natural termination. The force termination piggybacks on the message- passing mechanism to inform the worker to quiesce. Also there are few flags that represent the other thread's state / request state because certain code path is shared by multiple control flows, and there are certain code path where the async handles may not have come to life. Refactor into a LoopStopper abstraction that exposes routines to install a handle as well as to save a state. Refs: nodejs#21283
The current mechanism of uses two async handles, one owned by the creator of the worker thread to terminate a running worker, and another one employed by the worker to interrupt its creator on its natural termination. The force termination piggybacks on the message- passing mechanism to inform the worker to quiesce. Also there are few flags that represent the other thread's state / request state because certain code path is shared by multiple control flows, and there are certain code path where the async handles may not have come to life. Refactor into an AsyncRequest abstraction that exposes routines to install a handle as well as to save a state. PR-URL: #26099 Refs: #21283 Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
resuming from stalled state. I would rebase this, but before that would link to have a thought on the logistics:
|
Sorry, something went wrong.
|
@gireeshpunathil I think Environment makes the most sense, yes. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with @richardlau 's comments.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
This commit introduces a `node::Stop()` API. An identified use case for embedders is their ability to tear down Node while it is still running (event loop contain pending events) Here the assumptions are that (i) embedders do not wish to resort to JS routines to initiate shutdown (ii) embedders have the Environment handle handy. (iii) embedders stop Node through a second thread. Fixes: nodejs#19365 Refs: nodejs/user-feedback#51 PR-URL: nodejs#21283 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com>
This test was broken by d35af56. Refs: nodejs#21283 Fixes: nodejs#26712
This commit introduces a `node::Stop()` API. An identified use case for embedders is their ability to tear down Node while it is still running (event loop contain pending events) Here the assumptions are that (i) embedders do not wish to resort to JS routines to initiate shutdown (ii) embedders have the Environment handle handy. (iii) embedders stop Node through a second thread. Fixes: nodejs#19365 Refs: nodejs/user-feedback#51 PR-URL: nodejs#21283 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com>
This test was broken by d35af56. Refs: nodejs#21283 Fixes: nodejs#26712 PR-URL: nodejs#26713 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit introduces a `node::Stop()` API. An identified use case for embedders is their ability to tear down Node while it is still running (event loop contain pending events) Here the assumptions are that (i) embedders do not wish to resort to JS routines to initiate shutdown (ii) embedders have the Environment handle handy. (iii) embedders stop Node through a second thread. Fixes: #19365 Refs: nodejs/user-feedback#51 PR-URL: #21283 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com>
Notable changes:
* crypto
* Allow deriving public from private keys (Tobias Nießen)
[#26278](#26278).
* events
* Added a `once` function to use `EventEmitter` with promises
(Matteo Collina) [#26078](#26078).
* tty
* Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
[#26247](#26247).
* Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
[#26485](#26485).
* v8
* Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
in the format used by tools such as Chrome DevTools (James M Snell)
[#26501](#26501).
* worker
* Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
different vm.Contexts, aiding with the isolation that the vm module seeks to
provide (Anna Henningsen)
[#26497](#26497).
* C++ API
* `AddPromiseHook` is now deprecated. This API was added to fill an use case
that is served by `async_hooks`, since that has `Promise` support
(Anna Henningsen) [#26529](#26529).
* Added a `Stop` API to shut down Node.js while it is running
(Gireesh Punathil) [#21283](#21283).
* meta
* [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
the Technical Steering Committee
[#26657](#26657).
* Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
[#26730](#26730).
PR-URL: #26949
Notable changes:
* crypto
* Allow deriving public from private keys (Tobias Nießen)
[#26278](#26278).
* events
* Added a `once` function to use `EventEmitter` with promises
(Matteo Collina) [#26078](#26078).
* tty
* Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
[#26247](#26247).
* Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
[#26485](#26485).
* v8
* Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
in the format used by tools such as Chrome DevTools (James M Snell)
[#26501](#26501).
* worker
* Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
different vm.Contexts, aiding with the isolation that the vm module seeks to
provide (Anna Henningsen)
[#26497](#26497).
* C++ API
* `AddPromiseHook` is now deprecated. This API was added to fill an use case
that is served by `async_hooks`, since that has `Promise` support
(Anna Henningsen) [#26529](#26529).
* Added a `Stop` API to shut down Node.js while it is running
(Gireesh Punathil) [#21283](#21283).
* meta
* [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
the Technical Steering Committee
[#26657](#26657).
* Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
[#26730](#26730).
PR-URL: #26949
Notable changes:
* crypto
* Allow deriving public from private keys (Tobias Nießen)
[#26278](#26278).
* events
* Added a `once` function to use `EventEmitter` with promises
(Matteo Collina) [#26078](#26078).
* tty
* Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
[#26247](#26247).
* Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
[#26485](#26485).
* v8
* Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
in the format used by tools such as Chrome DevTools (James M Snell)
[#26501](#26501).
* worker
* Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
different vm.Contexts, aiding with the isolation that the vm module seeks to
provide (Anna Henningsen)
[#26497](#26497).
* C++ API
* `AddPromiseHook` is now deprecated. This API was added to fill an use case
that is served by `async_hooks`, since that has `Promise` support
(Anna Henningsen) [#26529](#26529).
* Added a `Stop` API to shut down Node.js while it is running
(Gireesh Punathil) [#21283](#21283).
* meta
* [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
the Technical Steering Committee
[#26657](#26657).
* Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
[#26730](#26730).
PR-URL: #26949
| Back | FazBrowse Home | New Git URL |
An identified use case for embedders is their ability to tear down Node while it is still running (event loop contain pending events)
Here the assumptions are that:
Fixes: #19365
Refs: nodejs/user-feedback#51
Checklist