-
Notifications
You must be signed in to change notification settings - Fork 918
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
[RFC] Node.js v16 Upgrade Plan #835
Comments
Please make sure to include changes to https://github.com/opensearch-project/opensearch-build when node is upgraded. It likely means building different docker images. |
One discussion point I'd like to see some opinions about is the versioning.. Since this is an upgrade of the nodejs major version.. it's expected that the OpenSearch Dashboards will bump to 2.0. So we can either:
I'm assuming Dashboards is leaning towards #3 as I don't think core is ready for a 2.0 release yet with all the breaking changes intended to go in. So if we choose #3 we'll then have to manage the confusion around the different compatibility matrix of the Dashboard and core versions. And we also would need to decide on what to do with plugins... as we have not yet decided to decouple the plugin versions from core/Dashboards. So if Dashboards 2.0 releases and we still have core 1.3 will we also bump all of our dashboard plugins to 2.0 and keep our backend plugins on 1.3? And then also have to deal with the confusion around our plugins having a version compatibility matrix now? |
Upgrading to use Node v16 would provide OpenSearch Dashboards a welcome performance and security boost and its customers a very long-term stability. However, Node v16 just entering LTS in a few weeks could prevent some from adopting the newer versions of Dashboards due to policy or technical barriers. Node v14 might not have all the newer performance optimizations of Node v16 but has been around long enough to not raise as many technical or policy barriers. Moreover, Node v14 will be in LTS Maintenance till the end of Apr 2023 which would allow for a decent expectation of stability for Dashboards customers. Additionally, while the current dependency of Dashboards on Node v10 might have been an adoption blocker for some, Node v16 could be an adoption blocker for the same reasons. While some might have the luxury of running Dashboards on a dedicated box, I believe many would welcome the ability to host several other web apps on the same box, ease of which could be dependent on the version of Node available. While there are workarounds to this problem, policy and technical barriers could still impact their adoption. As such, I believe Node v14 should also be considered as a possible upgrade target. In a perfect world, a version of Dashboards that runs on v14 shouldn't or could be made to not have much or any trouble running of Node v16 but if a difference exists, to maximize adoption, I would call for two releases, one for each version. However, if that is not an option, Dashboards should spin up a poll to gather information about the version of Node that its customers are more likely to adopt, in order to make an informed decision. |
@AMoo-Miki My personal PoV here is that we need as long of a runway as possible - v16 gives us a longer runway and it will give us more active development. In your use case (running dashboards on a shared box), I think most people use some sort of tool to run multiple versions (nvm as an example). |
@stockholmux, while Also, I love Dashboards striving to offer long-term stability; Node v14 would offer 18 months of it and Node v16, 30 months. That reason alone could excite many about Dashboards on Node v16 but if their organizations have policies barring them from using Node v16 for some time, they wouldn't adopt the newer versions of Dashboards yet. That's why I proposed using a poll to assess if current and potential customers can use Dashboards on Node v16 in (1) 3 months, (2) 6 months, or (3) maybe later. On a side note, it is possible that if Dashboards targets Node v14, it would only need to bump some dependencies to use Node v16. If at all that works, Dashboards' install scripts could intelligently install the needed deps to make it compatible with both versions of Node. |
@AMoo-Miki So, v16 will be Active LTS on 2021-10-26 which will be before the time we follow through on this RFC. If an organization wants to disallow active LTS, that seems like their problem, not ours. Every time Dashboard's adopts a new version of Node it's a new major version (according to SemVer). Every new major can cause heartburn for our users and those who want to develop plugins for Dashboards. The least we can do is give them the longest interval between needing to take TUMS. |
@stockholmux, I hear you; it helps that the upgrade will come some time after v16 goes to LTS. Node will always have 2 or 3 LTS versions simultaneously and because I would love to avoid heartburn for everyone, I would prefer to invest a bit more effort and make Dashboards run on all the LTS versions that people might be running with. |
@AMoo-Miki I totally understand wanting to include as many people and organizations as possible. Unfortunately, we are not set up to support all LTS versions available. It would be a massive project for our team that would include reworking the build system. There are other priorities that have larger impact for our users. I agree with what @stockholmux said previously regarding external organization policies. We can't control what they choose to disallow and it would be difficult to please everyone |
Node upgrade progress update: Overview OpenSearch Dashboards needs to upgrade the Node.js version from the current version, 10.24.1, to mitigate high severity CVEs affecting the application. The upgrade process intended to move to Node.js v16.9.1. During the upgrade process, it became clear that the amount of investigation and work required to upgrade to v16 was quite large and the team wanted to prioritize mitigating CVEs for the next OpenSearch release. Since the Node v16 upgrade wouldn’t be finished in time for the next release, the team decided on a move to Node.js v14 instead. Issues faced The jump to v16 is several major versions higher than the current Dashboards version. Particularly, the jump from v14 to v16 is a much bigger jump in terms of breaking changes than even the jump to v10 to v14. Node v16 has many breaking changes and we encountered the following issues:
Possible paths forward Moving to Node 14 (preferred solution) Node.js v14 is currently in LTS and will continue to be in LTS until 2023. This gives us an easier and earlier target to hit since we’re prioritizing mitigating CVEs. It also gives us time to plan and prioritize work for a future upgrade to Node v16 where we aren’t crunched for time because of CVEs and meeting predetermined release schedules. Continuing Node 16 and missing OpenSearch release Another option would be bringing on more people to help with the Node 16 upgrade. This would take more effort and would require us to miss the OpenSearch 1.3 release and wait until the following release. Since mitigating the high severity CVEs in Dashboards motivated the whole Node upgrade project, pushing off the CVE fixes further out while Node v10 is EOL is not a good option Continuing Node 16 and delaying OpenSearch release This option is the same as the above option but instead of missing the release date and waiting until the next one, we have the OpenSearch 1.3 release delayed until Node.js v16 upgrade is complete. |
Thanks for the research and prototyping @boktorbb-amzn. I think moving to 14 sounds like a good next step. |
So, 14 and 16 are breaking changes, so Dashboards will jump majors twice to get to the latest version? What's the timeline/target distribution version for 16? |
According to Node.js LTS schedule, 14 is EOL April 2023. My hunch is we'd upgrade in Q1 of 2023. |
@seanneumann That makes sense, if we could advance it a tad, there would be a nice symmetry of V14 = 2022, V16 = 2023. |
And naturally, I think everyone would like to avoid releasing Dashboards with a EOL Node ever again, so leaving to the last part of the support window is probably not preferred. |
Node upgrade to version 14.18.2 is complete. Will close this issue for now and will reopen when the time comes to evaluate the next version to upgrade to for OpenSearch Dashboards |
Overview
OpenSearch Dashboards is currently running an EOL Node.js version, Node.js v10.24.1. This current version of Node carries with it several high severity security vulnerabilities, as well as forces us to use older version of critical dependencies that carry their own share security vulnerabilities. The intent of the core Dashboards team is to upgrade to Node.js v16.9.1 which goes into LTS support in October 2021. The OpenSearch project is following the SemVer standard for versioning; therefore, the Node.js v16 upgrade is considered a breaking change and will require a version bump of Dashboards to 2.0.0Scope
The scope of the Node 16 upgrade is to do the minimum amount of dependency, code, and testing changes to allow for the core Dashboards team to address many of the CVEs that are present currently and blocked by our current Node.js version. While there may be many opportunities to make changes or upgrade packages because of the new version of Node, they would be out of scope of the work done to upgrade Dashboards to Node.js v16.Upgrade Proposal
The Node.js v16 upgrade will take the form of 3 phases that will be cycled through for each new plugin and developer wanting to upgrade. The 3 phases are somewhat coupled which makes working on the phases asynchronously difficult.Phase 1: Dependency Version Parity
This phase consists primarily of bringing all of Dashboards’ dependencies up to parity with what Node.js v16 expects/requires. Node v16 is many major versions higher than what we were working with before and will require upgrades to several dependencies. These changes will introduce cascading breaking changes to other dependencies, as well as to some code implementations in Dashboards.Below is a table of dependencies that are required to upgrade to Node.js v16 for core Dashboards:
msgpackr-extract
is not supported by Node 16 and requires lmdb-store to be bumped to latest.osd-optimizer
package for cluster cachingerror TS2430: Interface 'NodeJS.Module' incorrectly extends interface '__WebpackModuleApi.Module
The majority of the errors pertaining to dependency version errors and version mismatches will manifest themselves as build errors and package compatibility errors. Some of the errors will manifest as type/code logical errors but those will be handled in the next phase.
Phase 2: Breaking code changes
The next major obstacle is the plethora of breaking code changes introduced both by the new version of Node.js itself and the new versions of other dependencies. This phase requires a good amount of familiarity with breaking changes across major versions of dependencies. The three major types of code changes are listed below:non-null assertion operator
if you are sure that the value being passed in code is not going to be nullnon-null assertion operator
to no longer break the buildType<unknown> cannot be assigned to Type<type>
@types/node
not matching the actual typesurlUtils.encodeQuery
expects key/value pairs with values of typestring | string[] | null
,however
@types/node
says thaturl.query
has values of typestring | string[] | undefined
.After investigating this, it seems that no matter what the values will be of type
string | string[]
prependData
changed toadditionalData
additionalData
property requires an additionalcontent
parameterlmdb-store
version bump leads to a required rewrite of ourcache.ts
file in theosd-optimizer
packageget(key: string): T | undefined;
put(key: string, value: T, version?: number, ifVersion?: number): Promise<boolean>;
remove(key: string, ifVersion?: number): Promise<boolean>;
openDB<T>(options: { name: string; encoding: 'msgpack' | 'string' | 'json' | 'binary' }): Lmdb<T>;
getRange(options?: {
start?: T;
end?: T;
reverse?: boolean;
limit?: number;
versions?: boolean;
}): Iterable<{ key: string; value: T }>;
}
lmdb-store
v1.6.7, they have introduced new interfaces that must be used in our caching implementation.lmdb-store
types are:LmdbStore.RootDatabase
LmdbStore.Database
Cache
class is required to satisfy the more strict exception handling requirements of NodePhase 3: Runtime Errors
Runtime errors tend to be the hardest types of errors to track down in this process and they usually occur either as you attempt to run Dashboards usingyarn start
or they crop up while Dashboards is running itself.Node 16 Cluster error:
There seems to be an issue with importing the
cluster
module in theworker.ts
file in core.When switching the import from
import cluster from 'cluster'
toimport * as cluster from 'cluster'
we get the following error.API Error:
The following 2 errors occur when starting dashboards with
yarn start
after upgradinglmdb-store
,node-sass
, andsass-loader
. It stops Dashboards from loading the home app because the capabilities api call never succeeds.Looks like the above errors pertain to the api/core/capabilities API request
The text was updated successfully, but these errors were encountered: