nodejs/node

Tracking Issue: process.binding to internalBinding

jasnell opened this issue ยท 17 comments

Moving from process.binding() to internalBinding() will be a significant effort. There are hundreds of process.binding() uses inside core and many many userland references. It's going to take a while to convert everything.

TODO

  • inspector (this one is quite non-trivial... will require additional thought)

Done

updated to include all usage of NODE_BUILTIN_MODULE_CONTEXT_AWARE

I've got uv in progress now

@ChALkeR would it be possible to get info about the relative usage of all of these? i'm assuming there are some like serdes we can kill right away and others like util that will take longer.

I tried doing zlib but it broke npm.
I tried doing config but there's a buffer test that isn't feasible if config is moved. Planning to refactor

Just double checking, should all migration PRs should be marked as semver-major?

Unfortunately that's likely the best thing.

For some of this it's likely going to be quite tricky to have a proper migration strategy in place given that moving something over to internalBinding() means that the process.binding() version just stops working. We're going to have to take it very slow and work on migrating the bits with the smallest immediate impact and working up from there.

I would also like to contribute here. Can you please give me some heads up?

Hey,

I've been trying to move buffer to internalBinding to try and help out and I think I've gotten close but make -j4 test keeps giving these errors: https://hastebin.com/ecucikeraj.cs

You can see the branch that I'm working on here. Any help on maybe how to fix these errors/why they are happening would be very much appreciated ๐Ÿ˜„. Sorry for the bother if my changes are incorrect or this is not allowed.

@sneakyfish5 In the tests, I think we should be using require('internal/test/binding'). And also make sure that we have the --expose-internals flag. For example:

// Flags: --expose-internals
...
const { internalBinding } = require('internal/test/binding');

Could you double check the changes to the tests to verify that require('internal/bootstrap/loaders'); is not being used, which would produce the error you reported.

Is all of this going to be backported to v10.x-staging (with all bindings in the whitelist)?

@targos ... just to be extra safe, these are all semver-major even with the whitelist.

@jasnell OK, no problem. Then these should probably be labeled semver-major: #22370 #22480 #22482

Why is this even being discussed? Why does it matter? Please clarify ๐Ÿ˜• @jasnell

Now the inspector module is the only one left to be converted. Should we open a new issue to track it ? @jasnell

Hi, @starkwang. it appears that #24931 took care of inspector.

I think we can close this now.