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

Bump node to 16.11.1 #110684

Merged
merged 28 commits into from Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e5e911b
Bump node to ^16
jbudz Oct 4, 2021
8eb3b06
fix comment
jbudz Oct 4, 2021
03a1d7c
use jest timers
jbudz Oct 4, 2021
fc7db5e
bump mock-fs
jbudz Oct 4, 2021
75d8c55
Fix core type errors
rudolf Oct 7, 2021
f17e743
Unskipping tests that work on my machine
rudolf Oct 7, 2021
693e729
Merge branch 'master' into bump-node-16.8.0
jbudz Oct 8, 2021
a0bc1b5
skip new unhandled promise rejection
jbudz Oct 9, 2021
ec91485
Merge branch 'master' into bump-node-16.8.0
jbudz Oct 11, 2021
e1cba8d
Fix Nodejs v16 regression due to https://github.com/nodejs/node/issue…
rudolf Oct 11, 2021
d7b7dbb
Fix failing concurrent connections collector test
rudolf Oct 11, 2021
2511efe
Fix types after merge from master
rudolf Oct 11, 2021
6707f49
Merge branch 'master' into bump-node-16.8.0
jbudz Oct 11, 2021
c1889d3
Merge branch 'master' into bump-node-16.8.0
jbudz Oct 13, 2021
f819075
update servicenow test
jbudz Oct 13, 2021
8a9b6f7
Merge branch 'master' into bump-node-16.8.0
kibanamachine Oct 13, 2021
78bd79e
Skip unhandledRejection tests
rudolf Oct 13, 2021
b2f4eb5
Skip tests with unhandled promise rejection
rudolf Oct 13, 2021
d87568a
Fix discover jest failures
Oct 13, 2021
d78cdda
bump node to 16.11.1
jbudz Oct 13, 2021
296d75c
revert timeout increase
jbudz Oct 13, 2021
f393e81
skip unhandled promise rejection
jbudz Oct 13, 2021
e859e4d
Merge branch 'master' into bump-node-16.8.0
kibanamachine Oct 14, 2021
1a4665d
rm jest import
jbudz Oct 15, 2021
7c15cc0
Merge branch 'master' of github.com:elastic/kibana into bump-node-16.8.0
rudolf Oct 15, 2021
3c7714c
Merge branch 'master' into bump-node-16.8.0
kibanamachine Oct 15, 2021
1db9c01
skip unhandled promise rejection
jbudz Oct 16, 2021
f7d4173
Merge branch 'master' into bump-node-16.8.0
jbudz Oct 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/Dockerfile
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=14.17.6
ARG NODE_VERSION=16.10.0

FROM node:${NODE_VERSION} AS base

Expand All @@ -10,7 +10,7 @@ RUN apt-get update && \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-8-jre && \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-11-jre && \
rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
Expand Down
2 changes: 1 addition & 1 deletion .node-version
@@ -1 +1 @@
14.17.6
16.10.0
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
14.17.6
16.10.0
12 changes: 6 additions & 6 deletions WORKSPACE.bazel
Expand Up @@ -27,13 +27,13 @@ check_rules_nodejs_version(minimum_version_string = "3.8.0")
# we can update that rule.
node_repositories(
node_repositories = {
"14.17.6-darwin_amd64": ("node-v14.17.6-darwin-x64.tar.gz", "node-v14.17.6-darwin-x64", "e3e4c02240d74fb1dc8a514daa62e5de04f7eaee0bcbca06a366ece73a52ad88"),
"14.17.6-linux_arm64": ("node-v14.17.6-linux-arm64.tar.xz", "node-v14.17.6-linux-arm64", "9c4f3a651e03cd9b5bddd33a80e8be6a6eb15e518513e410bb0852a658699156"),
"14.17.6-linux_s390x": ("node-v14.17.6-linux-s390x.tar.xz", "node-v14.17.6-linux-s390x", "3677f35b97608056013b5368f86eecdb044bdccc1b3976c1d4448736c37b6a0c"),
"14.17.6-linux_amd64": ("node-v14.17.6-linux-x64.tar.xz", "node-v14.17.6-linux-x64", "3bbe4faf356738d88b45be222bf5e858330541ff16bd0d4cfad36540c331461b"),
"14.17.6-windows_amd64": ("node-v14.17.6-win-x64.zip", "node-v14.17.6-win-x64", "b83e9ce542fda7fc519cec6eb24a2575a84862ea4227dedc171a8e0b5b614ac0"),
"16.10.0-darwin_amd64": ("node-v16.10.0-darwin-x64.tar.gz", "node-v16.10.0-darwin-x64", "66a42483908aabd6d5fb19e9f3cebd6927dc84206b75b8801d9e010815083906"),
"16.10.0-linux_arm64": ("node-v16.10.0-linux-arm64.tar.xz", "node-v16.10.0-linux-arm64", "a9b477ea5c376729d59b39ecbb9bc5597b792a00ec11afbdf1e502b9b2557fb2"),
"16.10.0-linux_s390x": ("node-v16.10.0-linux-s390x.tar.xz", "node-v16.10.0-linux-s390x", "ca6bcb2098622880433b14323d4789ce7034eb94cd0a77134feed975ab5483ed"),
"16.10.0-linux_amd64": ("node-v16.10.0-linux-x64.tar.xz", "node-v16.10.0-linux-x64", "00c4de617038fe7bd60efd9303b83abe5a5df830a9221687e20408404e307c4e"),
"16.10.0-windows_amd64": ("node-v16.10.0-win-x64.zip", "node-v16.10.0-win-x64", "269ef35a91e7e8ce107ed09ca17e70d2feb448cf46ed6dbda86ac95cb90c5344"),
},
node_version = "14.17.6",
node_version = "16.10.0",
node_urls = [
"https://nodejs.org/dist/v{version}/{filename}",
],
Expand Down
3 changes: 3 additions & 0 deletions config/node.options
Expand Up @@ -4,3 +4,6 @@

## max size of old space in megabytes
#--max-old-space-size=4096

## do not terminate process on unhandled promise rejection
--unhandled-rejections=warn
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -69,7 +69,7 @@
"url": "https://github.com/elastic/kibana.git"
},
"resolutions": {
"**/@types/node": "14.14.44",
"**/@types/node": "16.10.2",
"**/chokidar": "^3.4.3",
"**/deepmerge": "^4.2.2",
"**/fast-deep-equal": "^3.1.1",
Expand All @@ -88,7 +88,7 @@
"**/underscore": "^1.13.1"
},
"engines": {
"node": "14.17.6",
"node": "16.10.0",
"yarn": "^1.21.1"
},
"dependencies": {
Expand Down Expand Up @@ -567,12 +567,12 @@
"@types/minimatch": "^2.0.29",
"@types/minimist": "^1.2.1",
"@types/mocha": "^8.2.0",
"@types/mock-fs": "^4.10.0",
"@types/mock-fs": "^4.13.1",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/ncp": "^2.0.1",
"@types/nock": "^10.0.3",
"@types/node": "14.14.44",
"@types/node": "16.10.2",
"@types/node-fetch": "^2.5.7",
"@types/node-forge": "^0.10.5",
"@types/nodemailer": "^6.4.0",
Expand Down Expand Up @@ -761,7 +761,7 @@
"mocha-junit-reporter": "^2.0.0",
"mochawesome": "^6.2.1",
"mochawesome-merge": "^4.2.0",
"mock-fs": "^4.12.0",
"mock-fs": "^5.1.1",
"mock-http-server": "1.3.0",
"ms-chromium-edge-driver": "^0.4.2",
"multimatch": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-dev-utils/src/proc_runner/proc.ts
Expand Up @@ -131,15 +131,15 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
await withTimeout(
async () => {
log.debug(`Sending "${signal}" to proc "${name}"`);
await treeKillAsync(childProcess.pid, signal);
await treeKillAsync(childProcess.pid!, signal);
await outcomePromise;
},
STOP_TIMEOUT,
async () => {
log.warning(
`Proc "${name}" was sent "${signal}" didn't emit the "exit" or "error" events after ${STOP_TIMEOUT} ms, sending SIGKILL`
);
await treeKillAsync(childProcess.pid, 'SIGKILL');
await treeKillAsync(childProcess.pid!, 'SIGKILL');
}
);

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-i18n/BUILD.bazel
Expand Up @@ -50,6 +50,7 @@ TYPES_DEPS = [
"@npm//@types/angular",
"@npm//@types/intl-relativeformat",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/prop-types",
"@npm//@types/react",
"@npm//@types/react-intl",
Expand Down
14 changes: 14 additions & 0 deletions packages/kbn-test/src/jest/run.ts
Expand Up @@ -28,6 +28,20 @@ import { map } from 'lodash';
// yarn test:jest src/core/public/core_system.test.ts
// :kibana/src/core/server/saved_objects yarn test:jest

// Patch node 16 types to be compatible with jest 26
// https://github.com/facebook/jest/issues/11640#issuecomment-893867514
/* eslint-disable */
declare global {
namespace NodeJS {
interface Global {}
interface InspectOptions {}

interface ConsoleConstructor
extends console.ConsoleConstructor {}
}
}
/* eslint-enable */

export function runJest(configName = 'jest.config.js') {
const argv = buildArgv(process.argv);

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/bootstrap.ts
Expand Up @@ -51,7 +51,7 @@ export async function bootstrap({ configs, cliArgs, applyConfigOverrides }: Boot
// This is only used by the LogRotator service
// in order to be able to reload the log configuration
// under the cluster mode
process.on('message', (msg) => {
process.on('message', (msg: any) => {
if (!msg || msg.reloadConfiguration !== true) {
return;
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ describe('trace', () => {
},
});
await root.preboot();
}, 30000);
}, 60000);

afterEach(async () => {
await root.shutdown();
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/http_server.test.ts
Expand Up @@ -7,7 +7,7 @@
*/

import { Server } from 'http';
import { rmdir, mkdtemp, readFile, writeFile } from 'fs/promises';
import { rm, mkdtemp, readFile, writeFile } from 'fs/promises';
import supertest from 'supertest';
import { omit } from 'lodash';
import { join } from 'path';
Expand Down Expand Up @@ -1419,7 +1419,7 @@ describe('setup contract', () => {

afterAll(async () => {
if (tempDir) {
await rmdir(tempDir, { recursive: true });
await rm(tempDir, { recursive: true });
}
});

Expand Down
6 changes: 2 additions & 4 deletions src/core/server/http/router/request.ts
Expand Up @@ -221,10 +221,8 @@ export class KibanaRequest<
}

private getEvents(request: Request): KibanaRequestEvents {
const finish$ = merge(
fromEvent(request.raw.res, 'finish'), // Response has been sent
fromEvent(request.raw.req, 'close') // connection was closed
).pipe(shareReplay(1), first());
// the response is completed, or its underlying connection was terminated prematurely
const finish$ = fromEvent(request.raw.res, 'close').pipe(shareReplay(1), first());
Copy link
Contributor

@rudolf rudolf Oct 11, 2021

Choose a reason for hiding this comment

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

As detailed in nodejs/node#38924 there's a v16 regression that wasn't documented. From v16 IncomingMessage 'close' event means the request stream was ended not the underlying socket. This meant that the close event would fire before we even got to send the response.

It's possible to listen to the 'close' event on the socket itself with request.raw.req.socket but the 'close' event on the response already captures both scenarios we care about: the response was sent or the socket terminated


const aborted$ = fromEvent<void>(request.raw.req, 'aborted').pipe(first(), takeUntil(finish$));
const completed$ = merge<void, void>(finish$, aborted$).pipe(shareReplay(1), first());
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/validator/validator.test.ts
Expand Up @@ -48,7 +48,7 @@ describe('Router validator', () => {
expect(() => validator.getParams({})).toThrowError('[foo]: Not a string');

expect(() => validator.getParams(undefined)).toThrowError(
`Cannot read property 'foo' of undefined`
`Cannot read properties of undefined (reading 'foo')`
);
expect(() => validator.getParams({}, 'myField')).toThrowError('[myField.foo]: Not a string');

Expand Down
Expand Up @@ -7,7 +7,7 @@
*/

import { join } from 'path';
import { rmdir, mkdtemp, readFile, readdir } from 'fs/promises';
import { rm, mkdtemp, readFile, readdir } from 'fs/promises';
import moment from 'moment-timezone';
import * as kbnTestServer from '../../../test_helpers/kbn_server';
import { getNextRollingTime } from '../appenders/rolling_file/policies/time_interval/get_next_rolling_time';
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('RollingFileAppender', () => {

afterEach(async () => {
if (testDir) {
await rmdir(testDir, { recursive: true });
await rm(testDir, { recursive: true });
}

if (root) {
Expand Down
Expand Up @@ -6,12 +6,12 @@
* Side Public License, v 1.
*/

import type { EventLoopDelayMonitor } from 'perf_hooks';
import type { IntervalHistogram as PerfIntervalHistogram } from 'perf_hooks';
import { monitorEventLoopDelay } from 'perf_hooks';
import type { IntervalHistogram } from '../types';

export class EventLoopDelaysMonitor {
private readonly loopMonitor: EventLoopDelayMonitor;
private readonly loopMonitor: PerfIntervalHistogram;
private fromTimestamp: Date;

/**
Expand Down
Expand Up @@ -195,6 +195,9 @@ describe('ServerMetricsCollector', () => {

waitSubject.next('go');
await Promise.all([res1, res2]);
// Give the event-loop one more cycle to allow concurrent connections to be
// up to date before collecting
await new Promise((resolve) => setTimeout(resolve, 0));
rudolf marked this conversation as resolved.
Show resolved Hide resolved
metrics = await collector.collect();
expect(metrics.concurrent_connections).toEqual(0);
});
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/status/plugins_status.ts
Expand Up @@ -128,7 +128,7 @@ export class PluginsStatusService {

return combineLatest(pluginStatuses).pipe(
map((statuses) => Object.fromEntries(statuses)),
distinctUntilChanged(isDeepStrictEqual)
distinctUntilChanged<Record<PluginName, ServiceStatus>>(isDeepStrictEqual)
);
})
);
Expand Down
6 changes: 3 additions & 3 deletions src/core/server/status/status_service.ts
Expand Up @@ -84,7 +84,7 @@ export class StatusService implements CoreService<InternalStatusServiceSetup> {
});
return summary;
}),
distinctUntilChanged(isDeepStrictEqual),
distinctUntilChanged<ServiceStatus<unknown>>(isDeepStrictEqual),
shareReplay(1)
);

Expand All @@ -100,7 +100,7 @@ export class StatusService implements CoreService<InternalStatusServiceSetup> {
});
return coreOverall;
}),
distinctUntilChanged(isDeepStrictEqual),
distinctUntilChanged<ServiceStatus<unknown>>(isDeepStrictEqual),
shareReplay(1)
);

Expand Down Expand Up @@ -186,7 +186,7 @@ export class StatusService implements CoreService<InternalStatusServiceSetup> {
elasticsearch: elasticsearchStatus,
savedObjects: savedObjectsStatus,
})),
distinctUntilChanged(isDeepStrictEqual),
distinctUntilChanged<CoreStatus>(isDeepStrictEqual),
shareReplay(1)
);
}
Expand Down
Expand Up @@ -17,7 +17,7 @@ const kibanaVersion = Env.createDefault(REPO_ROOT, getEnvOptions()).packageInfo.
const savedObjectIndex = `.kibana_${kibanaVersion}_001`;

describe('uiSettings/routes', function () {
jest.setTimeout(120_000);
jest.setTimeout(240_000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jbudz do you remember?

Copy link
Member Author

Choose a reason for hiding this comment

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

I reverted it with 296d75c. It was timing out occasionally, but it was earlier in the pull request and on jenkins resources.


beforeAll(startServers);
/* eslint-disable jest/valid-describe */
Expand Down
16 changes: 8 additions & 8 deletions src/dev/build/tasks/patch_native_modules_task.ts
Expand Up @@ -36,12 +36,12 @@ const packages: Package[] = [
extractMethod: 'gunzip',
archives: {
'darwin-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-83.gz',
sha256: 'ef49febcba972b488727ce329ea9d2b57590bb44001ed494f2aa1397c0ebc32b',
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-93.gz',
sha256: 'a267c6202d86d08170eb4a833acf81d83660ce33e8981fcd5b7f6e0310961d56',
},
'linux-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-83.gz',
sha256: '160217dd83eb7093b758e905ce09cb45182864c7df858bf2525a68924a23c509',
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-93.gz',
sha256: 'e0ca5d6527fe7ec0fe98b6960c47b66a5bb2823c3bebb3bf4ed4d58eed3d23c5',
},

// ARM build is currently done manually as Github Actions used in upstream project
Expand All @@ -55,12 +55,12 @@ const packages: Package[] = [
// * gzip -c build/Release/re2.node > linux-arm64-83.gz
// * upload to kibana-ci-proxy-cache bucket
'linux-arm64': {
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-83.gz',
sha256: '114505c60dbf57ad30556937ac5f49213c6676ad79d92706b96949d3a63f53b4',
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-93.gz',
sha256: '7a786e0b75985e5aafdefa9af55cad8e85e69a3326f16d8c63d21d6b5b3bff1b',
},
'win32-x64': {
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-83.gz',
sha256: '92ad420a6bfcedeb58dadf807a2f2901b05251d1edd3950051699929eda23073',
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-93.gz',
sha256: '37245ceb59a086b5e7e9de8746a3cdf148c383be9ae2580f92baea90d0d39947',
},
},
},
Expand Down
Expand Up @@ -95,7 +95,8 @@ afterAll(() => {
sizeMe.noPlaceholders = false;
});

test('renders DashboardGrid', () => {
// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699
test.skip('renders DashboardGrid', () => {
const { props, options } = prepare();
const component = mountWithIntl(
<KibanaContextProvider services={options}>
Expand All @@ -108,7 +109,8 @@ test('renders DashboardGrid', () => {
expect(panelElements.length).toBe(2);
});

test('renders DashboardGrid with no visualizations', () => {
// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699
test.skip('renders DashboardGrid with no visualizations', () => {
const { props, options } = prepare();
const component = mountWithIntl(
<KibanaContextProvider services={options}>
Expand All @@ -123,7 +125,8 @@ test('renders DashboardGrid with no visualizations', () => {
expect(component.find('EmbeddableChildPanel').length).toBe(0);
});

test('DashboardGrid removes panel when removed from container', () => {
// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699
test.skip('DashboardGrid removes panel when removed from container', () => {
const { props, options } = prepare();
const component = mountWithIntl(
<KibanaContextProvider services={options}>
Expand All @@ -142,7 +145,8 @@ test('DashboardGrid removes panel when removed from container', () => {
expect(panelElements.length).toBe(1);
});

test('DashboardGrid renders expanded panel', () => {
// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699
test.skip('DashboardGrid renders expanded panel', () => {
const { props, options } = prepare();
const component = mountWithIntl(
<KibanaContextProvider services={options}>
Expand Down Expand Up @@ -170,7 +174,8 @@ test('DashboardGrid renders expanded panel', () => {
).toBeUndefined();
});

test('DashboardGrid unmount unsubscribes', async (done) => {
// unhandled promise rejection: https://github.com/elastic/kibana/issues/112699
test.skip('DashboardGrid unmount unsubscribes', async (done) => {
const { props, options } = prepare();
const component = mountWithIntl(
<KibanaContextProvider services={options}>
Expand Down