Skip to content
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 undefined symbol CpuProfilingLoggingMode on Node 12.0 -> 12.15 #28

Merged
merged 2 commits into from Jun 29, 2021

Conversation

Widdershin
Copy link
Collaborator

Applies the suggested change from #27 to only include the CpuProfilingLoggingMode on Node 12.16+.

There is a problem though, which is that node-pre-gyp does not expose the Node version for substitution in the binary field in the package.json. The major/minor/patch mentioned in #27 correspond to the module version unfortunately.

I have a proposed fix, which is to wrap node-pre-gyp, and change the binary host mirror path depending on the Node version. This means that Node v12.0 -> v12.15 will attempt to download from https://github.com/hyj1991/v8-profiler-node8/releases/download/node-12-missing-symbol.

This stops the impacted versions from getting the wrong binary, and will currently cause them to fallback to build.

I wasn't sure what your process for publishing binaries is, but do you think it could be adapted to do a special build for Node 12.15 that is published to the node-12-missing-symbol subdirectory?

If you let me know what the process is I am happy to do all the grunt work. If we can do that all versions of Node will be able to install a prebuilt binary with the correct code.

@hyj1991
Copy link
Owner

hyj1991 commented Nov 18, 2020

Sorry, I have been busy these days, maybe I'll review it this weekend

@Widdershin
Copy link
Collaborator Author

Widdershin commented Nov 18, 2020 via email

@hyj1991 hyj1991 marked this pull request as draft June 28, 2021 09:29
@Widdershin Widdershin changed the base branch from master to v7.x-staging June 29, 2021 05:31
@Widdershin Widdershin force-pushed the fix-node-12-missing-symbol branch 2 times, most recently from 4e11afc to 52753f0 Compare June 29, 2021 07:14
@Widdershin Widdershin marked this pull request as ready for review June 29, 2021 07:19
@Widdershin
Copy link
Collaborator Author

Rebased and resolved conflicts.

This PR is fairly hacky, but I'm still not sure I can think of a better solution. Feel free to close it if it's not to your taste.

I'm working around this in my project by installing an older version of v8-profiler-node8 if the user is on 12.0-12.15, but since we now know that has a memory issue, I'll probably just recommend people avoid those versions of Node.

@hyj1991
Copy link
Owner

hyj1991 commented Jun 29, 2021

Maybe we can avoid this problem by not providing the pre-compiled binary of Node-v12.x.

@hyj1991
Copy link
Owner

hyj1991 commented Jun 29, 2021

Maintaining pre-compiled binary in this way seems will cause more maintenance problems.

@hyj1991
Copy link
Owner

hyj1991 commented Jun 29, 2021

In fact, I did not provide node-v12.x pre-compiled binary at v7.2.1@next.

@Widdershin
Copy link
Collaborator Author

That's probably the easiest fix, although I've found the pre-compiled binaries are extremely helpful, especially for environments like AWS Lambda or Azure App Services where the environment doesn't come with the toolchain for building native plugins.

I think as it stands this PR would cause it compile on Node 12.0-12.5, but would use a published binary for later versions, so we could keep shipping 12.x binaries.

The extra step of creating another binary for the impacted versions and placing it in /node-12-missing-symbol is optional, and I can see how that's a maintenance hassle.

I can always recommend that anyone who has issues with binary compilation use 14.x onwards, so I'm happy with any of the options really :)

@Widdershin
Copy link
Collaborator Author

Also just a heads up but v7.x-staging doesn't currently build on Node 12.0-12.15, needs the changes to cpu_profiler.cc from this PR.

@hyj1991
Copy link
Owner

hyj1991 commented Jun 29, 2021

And I also want to know will the modification of the install script affects the rest of the versions? If not, it seems we can use this for 12.x.

@Widdershin
Copy link
Collaborator Author

@hyj1991 it should just act as pass-through to node-pre-gyp, it will just set the npm_config_profiler_binary_host_mirror env var if we're on 12.0-12.15. So shouldn't have any impact on other versions.

Copy link
Owner

@hyj1991 hyj1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@hyj1991 hyj1991 merged commit a49bb05 into v7.x-staging Jun 29, 2021
@hyj1991
Copy link
Owner

hyj1991 commented Jun 30, 2021

Another thing is that we may be not able to put the pre-compiled binaries to the host:

https://github.com/hyj1991/v8-profiler-node8/releases/download/node-12-missing-symbol/xxxx

Actually, the automatically generated address of the GitHub release page is:

https://github.com/hyj1991/v8-profiler-node8/releases/download/xxxxx

@Widdershin
Copy link
Collaborator Author

Widdershin commented Jun 30, 2021 via email

@Widdershin Widdershin deleted the fix-node-12-missing-symbol branch June 30, 2021 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants