-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Upgrade to Node 16.x #98650
Comments
Pinging @elastic/kibana-operations (Team:Operations) |
Pinging @elastic/kibana-core (Team:Core) |
Also, cc @watson since you have done the recent upgrades. Is everyone OK targeting 7.16? 7.15 would probably ship before the active LTS of v16 starts, which is not recommended for production applications. |
The changes here include support for Node 16, and is needed for elastic#98650. Changelogs: https://github.com/hapijs/boom/releases https://github.com/hapijs/hapi/releases https://github.com/hapijs/hoek/releases https://github.com/hapijs/inert/releases https://github.com/hapijs/podium/releases
I think the comments on #77469 (comment) are still relevant. Although I'm in favour of moving towards crashing (and adopting v16) I believe this is a huge stability risk. We first need to get unhandled promise rejections in production to a reasonable number before we can crash as the default. |
I'm surprised if we still have a lot of unhandled promise rejections in our code base. I implemented a trap for this which should crash the process with a good error message in case of an unhandled promise rejection in both development and CI a while back: kibana/src/setup_node_env/exit_on_warning.js Lines 41 to 69 in 522a0c4
The idea with this was to find all these places so we could fix them before turning this behavior on in production as well. If we still have a lot of these, it could mean that this code is no longer working as intended. Could it be that part of our CI isn't triggering this code path? |
When looking over the previous 4 weeks there's still a huge number of unhandled rejections: Now if these 30% of clusters all only crashed once in a 4 week period that would be acceptable. I'm not exactly sure how to break down the data to get an idea of how often the average cluster would crash. But I think this is probably enough to postpone making it the default. We don't currently have enough context to make these unhandled rejections actionable e.g. an log message like:
Could come from all 2k+ places we're making calls to Elasticsearch |
Unfortunately my guess is that it's neither. Most of Kibana and our tests are written for the happy path, we rarely test network errors or any circuit_breaker_exceptions which Elasticsearch returns. |
Note that this is logged by the Core
It's interesting the message doesn't contain an error stack. I guess the root problem is in an ES client limitation that will be fixed in From elastic/elasticsearch-js#1542
|
I think we would also have to log the stack trace explicitly (or change ResponseError's |
The nice thing about the |
|
I feel like not including the stack in the toString() is more inline with the rest of Nodejs. So I think we should just log the stack explicitly. |
@rudolf you are absolutely right, the stack is logged by the
we should do something like: this.log.warn(`Detected an unhandled Promise rejection.\n${reason}\n${reason.stack}`); |
How does this sound?
Upgrading in 7.16.x when Node 14 LTS ends (2023-04-30) will delay ARM macOS support for development and production, so I'm hoping to avoid that if we can. It'll put more pressure on unresolved cases too. |
As we have learned the hard way from 6.8, we can't upgrade the previous-major branch to a new major Node.js version without so much work that it's not worth it. So we will/have to upgrade 7.16 to Node.js 16 before v8.0.0 is released - preferable as soon as it's LTS (which is in about a month). From a security perspective it's not advisable to stay on Node.js 14 🚨 |
Unfortunately this doesn't seem to be the case: given a file const err = new Error();
process.on('unhandledRejection', (reason, promise) => {
console.log(reason);
console.log(promise);
});
new Promise((res, rej) => rej(err));
So you can identify where the error originates from but not where the unhandled promise was constructed 😢 https://github.com/grantila/trace-unhandled aims to solve this problem by instrumenting the promise constructor, but doesn't recommend running it in production. |
@rudolf You're right. If would have sworn it was like I said - I'm not sure how I got that idea. But I agree that the |
Did we decide to do what @jbudz suggested in #98650 (comment) and no longer crash on unhandled promise rejections for 7.16 because we continue to see unhandled project rejections in production? If so, is there anything else that we need to worry about? |
@kobelb yes. No further concerns from my side 🥳 |
Node v16, the next LTS, was released on April 20th. Active LTS starts on October 18th. With this, I feel it would be best to target 7.16.
The primary driver for this upgrade at this time is to support ARM on macOS.
Related to #83946
The text was updated successfully, but these errors were encountered: