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

chore: upgrade to Node.js v18 #35999

Merged
merged 50 commits into from Nov 10, 2022
Merged

chore: upgrade to Node.js v18 #35999

merged 50 commits into from Nov 10, 2022

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Oct 12, 2022

Description of Change

Upgrade to Node.js v18.

Checklist

Release Notes

Notes: Upgraded Node.js to v18.10.0

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Oct 12, 2022
@codebytere codebytere force-pushed the upgrade-nodejs-v18 branch 5 times, most recently from 3621500 to fe16af8 Compare Oct 13, 2022
@codebytere codebytere added semver/minor backwards-compatible functionality semver/major incompatible API changes labels Oct 14, 2022
@codebytere codebytere removed semver/minor backwards-compatible functionality api-review/requested 🗳 labels Oct 14, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 19, 2022
@codebytere codebytere force-pushed the upgrade-nodejs-v18 branch 2 times, most recently from f85e532 to a9fdc59 Compare Oct 19, 2022
@codebytere codebytere force-pushed the upgrade-nodejs-v18 branch 2 times, most recently from 88c4b58 to 023e065 Compare Oct 24, 2022
@codebytere codebytere marked this pull request as ready for review Oct 25, 2022
@codebytere codebytere requested review from a team as code owners Oct 25, 2022
@codebytere codebytere marked this pull request as draft Oct 25, 2022
@codebytere codebytere force-pushed the upgrade-nodejs-v18 branch 2 times, most recently from 62c1a30 to 9a98ccb Compare Oct 26, 2022
@codebytere codebytere marked this pull request as ready for review Oct 26, 2022
shell/renderer/electron_renderer_client.cc Outdated Show resolved Hide resolved
rename from deps/base64/base64/lib/arch/avx/codec.c
rename to deps/base64/base64/lib/arch/avx/avx_codec.c
Copy link
Member

Choose a reason for hiding this comment

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

huh, how come we needed to rename these?

Copy link
Member Author

Choose a reason for hiding this comment

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

gn doesn't seem to allow duplicate filenames even if they're in different directories - this is what happens otherwise:

electron on git:upgrade-nodejs-v18 ❯ e build                               10:12AM
Running "e load-xcode --quiet"
Running "python3 goma_auth.py info" in /Users/codebytere/.electron_build_tools/third_party/goma
Running "ninja -j 200 electron" in /Users/codebytere/Developer/electron-gn/src/out/Testing
[0/1] Regenerating ninja files
ERROR at //third_party/electron_node/deps/base64/BUILD.gn:10:1: Duplicate object file
static_library("base64") {
^-------------------------
The target //third_party/electron_node/deps/base64:base64
generates two object files with the same name:
  obj/third_party/electron_node/deps/base64/base64/codec.o

It could be you accidentally have a file listed twice in the
sources. Or, depending on how your toolchain maps sources to
object files, two source files with the same name in different
directories could map to the same object file.

In the latter case, either rename one of the files or move one of
the sources to a separate source_set to avoid them both being in
the same target.
FAILED: build.ninja.stamp

Copy link
Member

Choose a reason for hiding this comment

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

Generally the way to solve this in GN is to use separate targets. Make an base64_avx target or something that has the avx-specific files in it. object names only need to be unique within a single target.

patches/node/build_add_gn_build_files.patch Outdated Show resolved Hide resolved
patches/node/build_add_gn_build_files.patch Outdated Show resolved Hide resolved
patches/node/build_add_gn_build_files.patch Outdated Show resolved Hide resolved
patches/node/build_add_gn_build_files.patch Outdated Show resolved Hide resolved
patches/node/build_add_gn_build_files.patch Outdated Show resolved Hide resolved
shell/common/node_bindings.cc Show resolved Hide resolved
patches/node/fix_crypto_tests_to_run_with_bssl.patch Outdated Show resolved Hide resolved
@@ -117,6 +117,7 @@
"parallel/test-trace-events-v8",
"parallel/test-trace-events-vm",
"parallel/test-trace-events-worker-metadata",
"parallel/test-wasm-web-api",
Copy link
Member

Choose a reason for hiding this comment

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

what breaks here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@nornagon i can add a follow-up for this but what's breaking would require a refactor far (imo) beyond the scope of this PR. Essentially, WebAssembly.compileStreaming and WebAssembly.instantiateStreaming are undefined when they shouldn't be. That's happening because Node.js' logic for enabling them here is called via node::SetIsolateUpForNode, which by necessity can only be called on an existing isolate. However, the switch to enable it here is called by gin during its own isolate initialization, which means that it ends up being undefined. I can look into a good way to fix this but imo impact is low and refactor burden is high so i'd prefer to just disable it for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #36282

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, happy to leave this for a followup, but it should probably be a release blocker as those methods are expected to be available in this version of Node.

shell/common/node_bindings.cc Outdated Show resolved Hide resolved
Copy link
Member

@nornagon nornagon left a comment

Choose a reason for hiding this comment

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

LGTM but i'd love to see a refactor to use a separate GN target instead of renaming files!

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

API LGTM

@codebytere codebytere merged commit 75d2caf into main Nov 10, 2022
21 of 22 checks passed
@codebytere codebytere deleted the upgrade-nodejs-v18 branch Nov 10, 2022
@release-clerk
Copy link

release-clerk bot commented Nov 10, 2022

Release Notes Persisted

Upgraded Node.js to v18.10.0

import { net, session, ClientRequest, BrowserWindow, ClientRequestConstructorOptions } from 'electron/main';
import * as http from 'http';
import * as url from 'url';
import { AddressInfo, Socket } from 'net';
import { emittedOnce } from './events-helpers';
import { defer, delay } from './spec-helpers';

// See https://github.com/nodejs/node/issues/40702.
dns.setDefaultResultOrder('ipv4first');
Copy link

Choose a reason for hiding this comment

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

This "fix" should be reverted. It causes problems for lots of people using IPv6.

Copy link

@treysis treysis Jan 27, 2023

Choose a reason for hiding this comment

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

Better use net.autoSelectFamily instead which enabled Happy Eyeballs according to RFC 8305 (requires upgrading to node v18.13).

Choose a reason for hiding this comment

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

Also why is this change not addressed in the release notes in this PR?

This change is not in the upstream and some downstream projects where expecting this option to change as per v17 release notes.

If there is a problem with it, it should raised as an issue of this project, discussed with the community and fixed accordingly. Not by silently hiding it in large change.

Copy link

Choose a reason for hiding this comment

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

Fully agree. This has to be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants