-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: check V8 version directly instead of inferring from NMV #840
Conversation
Hmm, NodeJs 10.11.0 uses v8 6.8.275.32 (see https://github.com/nodejs/node/blob/v10.11.0/deps/v8/include/v8-version.h) so it seems electron uses something else then 10.11.0. Is there any define available to use to distinguish between node.js and electron? Node.JS updates v8 within a major release cycle a few times. Using checks for v8 versions makes it easy to get binaries not consistent across a major node.js version. Maybe a check on |
I believe so, my thinking here is if something truly depends on a V8 API being available we should probably be checking the V8 version as that strictly dictates the APIs available rather than inferring from the node version / NMV
Node major releases have to remain ABI compatible though right? If an API is removed inside V8 I don't think they could update to that V8 version inside a major release. I.e. It's an impossible situation for Node 12.0 to have a V8 API that 12.2 does not have. I'm not super familiar with how that works though so that's based only on my understanding as an observer. EDIT:
We shipped node 10.11 but using the V8 version that Chromium 69 shipped with. We are tied to the Chromium V8 version rather than the node V8 version. We try to match them but in some cases it's not possible |
Yes, major node versions are abi stable, not just for v8 also for libuv, openssl,... and the node module version is intended to represent an ABI version. And yes, v8 can't remove an API. The solution chosen by node is to agree with v8 team on a release schedule and pull in ABI changes for future v8 versions into that one used in first major release. see nodejs/node#25082 if you are interested in more details in this. |
@Flarna I think we are OK using V8 versions here then, because any patches that node pulls in as extras on top of their V8 version we also float on top of our embedded version of node so they will be consistent here. This definitely fixes the current issue, and moving forward it would probably make sense for |
Please do. This discrepancy between Node.js and Electron has been popping up for years. |
FWIW, I don't think these checks are going to be very robust. Node.js can (and has) upgraded V8 in stable releases. Checking for V8. 7.0 breaks when Node.js upgrades to V8 7.1.
It's usually possible to maintain API and ABI compatibility with only minor fixes to Node's fork of V8 and so that is what we do. We still bump the minor and/or major version number. |
Concrete NodeJs 10.0.0 used 6.6.346.24 and current 10.15.3 uses 6.8.275.32. |
A table with all the version number details from the past can be found at https://nodejs.org/en/download/releases/ |
For Node.js 11 it probably doesn't matter since it's short-lived but Node.js 12 (coming out next month) will be a LTS release and it's almost certainly going to see V8 upgrades. It'll ship V8 7.3 out of the gate. I'm pretty sure NAN will emit warnings with that version after this PR because |
I think it works as the isolate version is used for all v8 versions >7.0 which matches to the previous check to Node.JS 11. I assume v11 will not get an V8 update anymore. I gave it a fast try with Node 12 nightly which uses 7.3 and the only warnings I get (from node and NAN) are because |
The changes introduced in d113c02 make the (historically correct) assumption that it's impossible for an older version of node (and therefore an older version of V8) to have a higher NODE_MODULE_VERSION.
As of Electron
4.1.0
however this is not the case, it embeds node10.11
with v8v6.9.427.24
but has the NMV of69
which is higher than node 11's NMV of68
. As Electron continuously gets their own NMV numbers (refs nodejs/TSC#651) we can't make this assumption any more. Currently native modules are failing to build against Electron 4 because of this issue.This PR updates these checks to check what actually matters here (the V8 version).
cc @kkoopa @Flarna