-
Notifications
You must be signed in to change notification settings - Fork 18
Form team/group to define "embedding requirements" #51
Comments
@groundwater I was hoping you might be interested in this, wondering if you go the ping through @nodejs/delivery-channels |
Thanks for CCing. We NW.js maintainers would like to keep an eye on this. Though we just released NW.js 0.30.1 with Node.js 10.0.0 within 24 hours, rebasing with latest Node.js is still a significant effort. We are interested in this topic on how to integrate Node more easily. |
@rogerwang thanks for replying, will include you when we get things rolling |
Hi @mhdawson. Thanks for this! We have a number of folks at JSConf EU, and I believe there is a node's summit occurring shortly beforehand. Would it be worth sending a few of our folks to kick this discussion off in-person? |
I think having folks at the summit would be awesome!
…On Fri, Apr 27, 2018, 11:53 AM Jacob Groundwater ***@***.***> wrote:
Hi @mhdawson <https://github.com/mhdawson>. Thanks for this! We have a
number of folks at JSConf EU, and I believe there is a summit occurring
shortly beforehand. Would it be worth sending a few of our folks to kick
this discussion off in-person?
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAecV7sxNVOg_xqfGPx2b0LqaasSzJ4dks5tsz79gaJpZM4TSdYW>
.
|
Hello, yesterday i enabled the |
@groundwater I don't necessarily want to wait to start discussing and possibly meeting remotely until after the summit (not everybody will be at the summit either), but getting together in person at the summit would be great. |
@mhdawson agreed. Would you like to kick this off asynchronously or via a synchronous video discussion? |
I’d definitely like to be involved in this, yes. Also, maybe /cc @fs-eire … please let me know if this is not the kind of thing you want to be pinged in, but it sounded like you might be somebody who wants to be aware that this is happening? |
I think starting with a video call to get together to review what I suggested above as the way forward and to agree on the best way to work together (github, regular meetings or whatever). I'll get together with @yhwang to set up a kickoff meeting. |
@gireeshpunathil FYI. |
We currently embed the shared library in IBM Integration Bus, we recently updated in quick succession from node 4 through 6 to node 8 and found the upgrade process pretty painful so anything we can do to help stabilise the interfaces or improve our own integration would be a benefit to us. We are a bit unusual in that we also embed a JVM and on windows platforms a CLR as well so we may have some use cases / problems that other users do not so might bring some different use cases to the table. |
@davicrig sounds good, your insight will be valuable. |
With @mhdawson help, we plan to have a conference call to discuss about the shared lib usage and try to form the group for embedding users. Here is the agenda: ================================
Feel free to add item into the agenda for discussion. I created a doodle poll for the conference call ==> https://doodle.com/poll/tamxygwfsgh5dr5w. Please select your available time slots then we may select a proper time for the conference call once the most people who are interested in vote. |
@gabrielschulhof adding you as an FYI as from your comments in a different issue I'm hoping you are interested in participating here as well. |
Hey, just letting you know that there's a project that embeds .NET in Node but also the other way around. Perhaps it can provide some additional usage context. https://github.com/tjanczuk/edge |
I'd like to add that https://github.com/janeasystems/nodejs-mobile is a project that allows you to embed node into Android/iOS application; Jaime @jaimecbernardo, might be interested in this; as I believe it would simplify updates if this was a consistent interface. |
@addaleax if you can make one of the proposed times can you fill out the doodle? |
@groundwater can you fill out the doodle? |
@rogerwang can you fill out the doodle? |
Hi, in debian, it's considered to be "the right thing" to build (independently packaged) node addons against libnode-dev. I've enabled this with nodejs 10 debian package (which is sitting in experimental right now because many addons are still not compatible with node 10). |
@kapouer are you talking about node.js as a shared library or things like openssl. The topic of this thread is the former. |
@mhdawson node.js as a shared library (which is as you point out, linked to other shared libs in debian). |
@kapouer I guess the |
The poll result is 15:00 - 16:00 UTC/GMT this Thursday (17/May). Look forward to talking with you then. I will send out the invitation later. |
Doodle was closed. Will try to attend on Thursday. |
@rogerwang sorry for that and welcome to join the discussion on Thursday. And here is the zoom that we will use for the meeting: https://zoom.us/webinar/134723812 |
I'll be there :) |
@yhwang , from the perspective of nodejs-mobile:
Challenges / pain points:
|
@orangemocha - interesting scenarios!
did you mean
can't we solve this by simply redefining |
Yes :) Edited inline. Thanks.
That is certainly feasible, and probably a fine solution. Currently we are redirecting the underlying process.stdout/stderr streams, but I have no knowledge of use cases out there that depend on those. |
Background IBM Integration Bus is an Integration Platform provides a graphical programming environment for connecting disparate systems including transformation, enrichment, enhancement etc of inflight data flowing between these systems. User built applications are executed on a native C++ server process that also embeds a number of specific language runtimes (Java, .NET (on windows), nodejs. Functional Use Cases We embed the node.js engine to allow customer access to integration points that are accessible via node.js libraries. For example using the loopback framework. This includes marshalling / unmarshalling the data between our internal "message tree" format and javascript datatypes. Executed node.js should be able to take advantage of the full JS ecosystem including modules that may have native dependencies. Node dependencies are configured offline to deployment of the application using npm / node-gyp run in an external node process (ie/ the executable not the shared library.) Building/Testing use cases In order to support internal regression testing we also require the facility to execute arbitrary javascript code executed on the embedding node.js runtime (for example to test our integration layer and to provide integration testing on our connectors). In order to support internal unit testing we test our own customer javascript using the usual frameworks chai / sinon etc and execute tests of pure JS code from an external node process. We require code-coverage for our customer JS code and fail builds the reduce code coverage. For the dependencies that we ship we run npm and by extension node-gyp as part of the build process. Pain Points The lifecycle of our major versions is much longer than the node.js lifecycle therefore we need to make major version updates within our release cycle. We have recently completed upgrade from node 4 to 6 and are in the process of moving to 8. In each case instability in the v8 API has lead us to need to rework the code which interfaces between the node.js engine and our C++ runtime. Providing a stable API for embedding to would relieve the need for us to do this rework. As part of an upgrade one of the significant issues we had was finding a way to ensure that our dependent node modules for both build and test were rebuild / recompiled with node-gyp, although this might belong in a different discussion we found that instability in many of the test framework APIs resulted in us having to make minor refactors to huge numbers of tests. On windows we need to delay load the shared lib because native modules built by both the connectors that we ship and potentially user defined connectors contain the node executable name in their symbols. In order to prevent users having to recompile their modules just to work with us we needed to use dumpbin to export all the node executable symbols and redirect them to our own lib which we then chain to the shared lib. Being able to remove this would remove considerable complexity to our build. Since we are embedding the engine we expect to control the lifecycle of the node engine itself and any event loops / handles etc so that we can shutdown cleanly. During the upgrade to newer node versions we found that the shutdown process we were previously using did not work correctly. We eventually found that there were ways around this but a lack of documentation on object lifecycle made this very difficult for us. Because we ship a JVM we have a reliance on certain signal handlers registered by the JVM and we have seen in the past that some node version register for -3. This in particular is problematic because this signal is used by the JVM to produce a javacore / heapdump which can be essential to diagnose problems in user supplied java code. We would ideally like the signal handlers used by the embedded node runtime to be documented and if possible have some more flexbility on which set of signals are used (for example something along the lines of https://www.ibm.com/support/knowledgecenter/en/SSYKE2_7.0.0/com.ibm.java.lnx.70.doc/diag/appendixes/cmdline/Xrs.html) The node.js runtime is pretty opaque to us so we are not able to provide our users much operational information around the node runtime. For example we cant display how busy the event loops is, what the memory usage of the node engine is etc which means we do not have administrative feature parity with our other embedded runtimes. We note that OpenSSL is statically linked to the node.js shared lib which makes the symbols available to the runtime loader on linux. Since we also ship OpenSSL (and consume other libraries which in term use OpenSSL) we are in a position where our code may end up using the node-provided symbols. If the OpenSSL versions differ between node.js and what we ship or if different global variables that share a name this can cause unknown behaviour. We increasingly have a need to update OpenSSL frequently to allow customers to mitigate exposure to high profile SSL attacks and we have imposed timelines on being able to make these upgrade. Decoupling from node version would help us significantly. Having a long support lifecycle for a major version (minimum of 8 years) also puts us on a compiler upgrade treadmill if we want to maintain node currency especially on Visual Studio where we need to distribute additional runtime versions and where load-time binary compatibility between compiler versions seems to be weaker than gcc. @gireeshpunathil also mentioned different icu options, we have seen similar symbol clashes with other third party binaries involving icu and our preference is for icu to be privately namespaced in a library. |
@yhwang we should probably start planning the next meeting. |
FYI @codebytere. @rubys is starting to get this started again (taking over from @yhwang). From your the presentation at the collaborator summit it sounds like you would want to be involved. |
In my case I am building a high performance FaaS (Function as a Service) called MetaCall (https://metacall.io). For me it was necessary to have embedding API for NodeJS. But as it was not possible I managed to solve it myself. I have add a detailed post in another issue (nodejs/node#23265 (comment)) detailing how I have achieved it. With the MetaCall library you can easily embed NodeJS in any language (not just C/C++). I leave here the link to the repository (https://github.com/metacall/core). It may be interesting for NodeJS devs or other people looking to embed NodeJS. |
@rubys would be great to move the formation of this group forward. |
Hi @mhdawson , I've been doing some node embedding and development in my free time, focusing on integration with native C++ apps (and thereby using node-addon-api as well). I'm highly interested in where this goes, so I've subscribed to this issue. Is there anything else you would recommend I do so I can stay in the loop regarding node embedding and API changes? Not sure what this group is you mentioned, but I would love to contribute in any way possible (inputs for use-cases, testing apis, feedback, etc) Thanks, Kevin |
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 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 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>
There is ongoing work to allow Node.js to be built as a static or shared library. This allows Node.js to be embedded in the process of another application. See nodejs/node#14158, which is also being backported to 8.X and 6.X (nodejs/node#19047, nodejs/node#19050).
@yhwang is currently working on adding testing to the CI. That testing, however, will just be to make sure that the existing Node.js tests cases pass when using the static/shared library.
After that, we will want to add testing that covers typical use cases related to embedding Node.js into an application using either the static or shared libraries. I believe as part of that we'll also find that there are still some things missing. I just ran across this PR nodejs/node#19005 which aims to address some of those kinds of things.
At this point, I'm wondering if there is enough interest to form a group that would work together or a number of months (maybe more) on defining and validating the different embedding use cases. The work would likely be:
@yhwang
@nodejs/delivery-channels
@addaleax
@luminosuslight, @cmfcmf, @Hannes01071995, @justus-hildebrand, @msoechting
@nodejs/tsc
@dshaw
The text was updated successfully, but these errors were encountered: