Skip to content

Commit

Permalink
2021-05-11, Version 14.17.0 'Fermium' (LTS)
Browse files Browse the repository at this point in the history
Notable Changes:

Diagnostics channel (experimental module):

`diagnostics_channel` is a new experimental module that provides an API
to create named channels to report arbitrary message data for
diagnostics purposes.

The module was initially introduced in Node.js v15.1.0 and is
backported to v14.17.0 to enable testing it at a larger scale.

With `diagnostics_channel`, Node.js core and module authors can publish
contextual data about what they are doing at a given time. This could
be the hostname and query string of a mysql query, for example. Just
create a named channel with `dc.channel(name)` and call
`channel.publish(data)` to send the data to any listeners to that
channel.

```js
const dc = require('diagnostics_channel');
const channel = dc.channel('mysql.query');

MySQL.prototype.query = function query(queryString, values, callback) {
  // Broadcast query information whenever a query is made
  channel.publish({
    query: queryString,
    host: this.hostname,
  });

  this.doQuery(queryString, values, callback);
};
```

Channels are like one big global event emitter but are split into
separate objects to ensure they get the best performance. If nothing is
listening to the channel, the publishing overhead should be as close to
zero as possible. Consuming channel data is as easy as using
`channel.subscribe(listener)` to run a function whenever a message is
published to that channel.

```js
const dc = require('diagnostics_channel');
const channel = dc.channel('mysql.query');

channel.subscribe(({ query, host }) => {
  console.log(`mysql query to ${host}: ${query}`);
});
```

The data captured can be used to provide context for what an app is
doing at a given time. This can be used for things like augmenting
tracing data, tracking network and filesystem activity, logging
queries, and many other things. It's also a very useful data source
for diagnostics tools to provide a clearer picture of exactly what the
application is doing at a given point in the data they are presenting.

Contributed by Stephen Belanger (#34895).

UUID support in the crypto module:

The new `crypto.randomUUID()` method now allows to generate random
[RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) Version 4
UUID strings:

```js
const { randomUUID } = require('crypto');

console.log(randomUUID());
// 'aa7c91a1-f8fc-4339-b9db-f93fc7233429'
```

Contributed by James M Snell (#36729).

Experimental support for `AbortController` and `AbortSignal`:

Node.js 14.17.0 adds experimental partial support for `AbortController`
and `AbortSignal`.

Both constructors can be enabled globally using the
`--experimental-abortcontroller` flag.

Additionally, several Node.js APIs have been updated to support
`AbortSignal` for cancellation.
It is not mandatory to use the built-in constructors with them. Any
spec-compliant third-party alternatives should be compatible.

`AbortSignal` support was added to the following methods:

* `child_process.exec`
* `child_process.execFile`
* `child_process.fork`
* `child_process.spawn`
* `dgram.createSocket`
* `events.on`
* `events.once`
* `fs.readFile`
* `fs.watch`
* `fs.writeFile`
* `http.request`
* `https.request`
* `http2Session.request`
* The promisified variants of `setImmediate` and `setTimeout`

Other notable changes:

* doc:
  * revoke deprecation of legacy url, change status to legacy (James M Snell) (#37784)
  * add legacy status to stability index (James M Snell) (#37784)
  * upgrade stability status of report API (Gireesh Punathil) (#35654)
* deps:
  * V8: Backport various patches for Apple Silicon support (BoHong Li) (#38051)
  * update ICU to 68.1 (Michaël Zasso) (#36187)
  * upgrade to libuv 1.41.0 (Colin Ihrig) (#37360)
* http:
  * add http.ClientRequest.getRawHeaderNames() (simov) (#37660)
  * report request start and end with diagnostics\_channel (Stephen Belanger) (#34895)
* util:
  * add getSystemErrorMap() impl (eladkeyshawn) (#38101)

PR-URL: #38507
  • Loading branch information
danielleadams committed May 11, 2021
1 parent 4ebb88f commit 16e00a1
Show file tree
Hide file tree
Showing 20 changed files with 840 additions and 41 deletions.
8 changes: 6 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,9 @@ accessed using `require('buffer')`.

### `buffer.atob(data)`
<!-- YAML
added: v15.13.0
added:
- v15.13.0
- v14.17.0
-->

> Stability: 3 - Legacy. Use `Buffer.from(data, 'base64')` instead.
Expand All @@ -3304,7 +3306,9 @@ and binary data should be performed using `Buffer.from(str, 'base64')` and

### `buffer.btoa(data)`
<!-- YAML
added: v15.13.0
added:
- v15.13.0
- v14.17.0
-->

> Stability: 3 - Legacy. Use `buf.toString('base64')` instead.
Expand Down
16 changes: 12 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ controller.abort();
<!-- YAML
added: v0.1.91
changes:
- version: v15.4.0
- version:
- v15.4.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36308
description: AbortSignal support was added.
- version: v8.8.0
Expand Down Expand Up @@ -380,7 +382,9 @@ changes:
- version: v15.11.0
pr-url: https://github.com/nodejs/node/pull/37325
description: killSignal for AbortSignal was added.
- version: v15.6.0
- version:
- v15.6.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36603
description: AbortSignal support was added.
- version:
Expand Down Expand Up @@ -489,7 +493,9 @@ changes:
- version: v15.11.0
pr-url: https://github.com/nodejs/node/pull/37325
description: killSignal for AbortSignal was added.
- version: v15.5.0
- version:
- v15.5.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36432
description: AbortSignal support was added.
- version:
Expand Down Expand Up @@ -1160,7 +1166,9 @@ See [Advanced serialization][] for more details.

### Event: `'spawn'`
<!-- YAML
added: v15.1.0
added:
- v15.1.0
- v14.17.0
-->

The `'spawn'` event is emitted once the child process has spawned successfully.
Expand Down
4 changes: 3 additions & 1 deletion doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ modifying the stack trace.

### `--experimental-abortcontroller`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
changes:
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/33527
Expand Down
4 changes: 3 additions & 1 deletion doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -4707,7 +4707,9 @@ console.log(`The dice rolled: ${n}`);

### `crypto.randomUUID([options])`
<!-- YAML
added: v15.6.0
added:
- v15.6.0
- v14.17.0
-->

* `options` {Object}
Expand Down
4 changes: 3 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,9 @@ future release.
### DEP0116: Legacy URL API
<!-- YAML
changes:
- version: v15.13.0
- version:
- v15.13.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/37784
description: Deprecation revoked. Status changed to "Legacy".
- version: v11.0.0
Expand Down
16 changes: 12 additions & 4 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ callbacks will be called with an error with code `ECANCELLED`.

### `resolver.setLocalAddress([ipv4][, ipv6])`
<!-- YAML
added: v15.1.0
added:
- v15.1.0
- v14.17.0
-->

* `ipv4` {string} A string representation of an IPv4 address.
Expand Down Expand Up @@ -439,7 +441,9 @@ will contain an array of canonical name records available for the `hostname`

## `dns.resolveCaa(hostname, callback)`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* `hostname` {string}
Expand Down Expand Up @@ -732,7 +736,9 @@ The following methods from the `dnsPromises` API are available:

### `resolver.cancel()`
<!-- YAML
added: v15.3.0
added:
- v15.3.0
- v14.17.0
-->

Cancel all outstanding DNS queries made by this resolver. The corresponding
Expand Down Expand Up @@ -960,7 +966,9 @@ Here is an example of the result object:

### `dnsPromises.resolveCaa(hostname)`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* `hostname` {string}
Expand Down
1 change: 1 addition & 0 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ added: v8.5.0
changes:
- version:
- v15.3.0
- v14.17.0
- v12.22.0
pr-url: https://github.com/nodejs/node/pull/35781
description: Stabilize modules implementation.
Expand Down
1 change: 1 addition & 0 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ regular `'error'` listener is installed.
<!-- YAML
added:
- v15.2.0
- v14.17.0
-->
* `emitterOrTarget` {EventEmitter|EventTarget}
* `eventName` {string|symbol}
Expand Down
33 changes: 28 additions & 5 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,9 @@ See the POSIX chown(2) documentation for more detail.
<!-- YAML
added: v0.0.2
changes:
- version: v15.9.0
- version:
- v15.9.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/37174
description: A default callback is now used if one is not provided.
- version: v10.0.0
Expand Down Expand Up @@ -2836,7 +2838,9 @@ changes:
pr-url: https://github.com/nodejs/node/pull/37460
description: The error returned may be an `AggregateError` if more than one
error is returned.
- version: v15.2.0
- version:
- v15.2.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/35911
description: The options argument may include an AbortSignal to abort an
ongoing readFile request.
Expand Down Expand Up @@ -3554,7 +3558,9 @@ The `atime` and `mtime` arguments follow these rules:
<!-- YAML
added: v0.5.10
changes:
- version: v15.9.0
- version:
- v15.9.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/37190
description: Added support for closing the watcher with an AbortSignal.
- version: v7.6.0
Expand Down Expand Up @@ -3883,7 +3889,9 @@ changes:
pr-url: https://github.com/nodejs/node/pull/37460
description: The error returned may be an `AggregateError` if more than one
error is returned.
- version: v15.2.0
- version:
- v15.2.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
Expand Down Expand Up @@ -5924,7 +5932,22 @@ Emitted when the {fs.WriteStream}'s underlying file descriptor has been closed.
#### Event: `'open'`
<!-- YAML
added: v0.1.93
added:
- v10.0.0
- v0.1.93
changes:
- version: v14.17.0
pr-url: https://github.com/nodejs/node/pull/35993
description: The options argument may include an AbortSignal to abort an
ongoing writeFile request.
- version: v14.12.0
pr-url: https://github.com/nodejs/node/pull/34993
description: The `data` parameter will stringify an object with an
explicit `toString` function.
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31030
description: The `data` parameter won't coerce unsupported input to
strings anymore.
-->
* `fd` {integer} Integer file descriptor used by the {fs.WriteStream}.
Expand Down
32 changes: 24 additions & 8 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ accessible.

## Class: `AbortController`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
changes:
- version: v15.4.0
pr-url: https://github.com/nodejs/node/pull/35949
Expand All @@ -44,22 +46,28 @@ console.log(ac.signal.aborted); // Prints True

### `abortController.abort()`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

Triggers the abort signal, causing the `abortController.signal` to emit
the `'abort'` event.

### `abortController.signal`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* Type: {AbortSignal}

### Class: `AbortSignal`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* Extends: {EventTarget}
Expand All @@ -69,7 +77,9 @@ The `AbortSignal` is used to notify observers when the

#### Static method: `AbortSignal.abort()`
<!-- YAML
added: v15.12.0
added:
- v15.12.0
- v14.17.0
-->

* Returns: {AbortSignal}
Expand All @@ -78,7 +88,9 @@ Returns a new already aborted `AbortSignal`.

#### Event: `'abort'`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

The `'abort'` event is emitted when the `abortController.abort()` method
Expand Down Expand Up @@ -112,14 +124,18 @@ result in memory leaks.

#### `abortSignal.aborted`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* Type: {boolean} True after the `AbortController` has been aborted.

#### `abortSignal.onabort`
<!-- YAML
added: v15.0.0
added:
- v15.0.0
- v14.17.0
-->

* Type: {Function}
Expand Down
12 changes: 9 additions & 3 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ http.get({
<!-- YAML
added: v0.3.4
changes:
- version: v15.6.0
- version:
- v15.6.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36685
description: Change the default scheduling from 'fifo' to 'lifo'.
- version:
Expand Down Expand Up @@ -779,7 +781,9 @@ const cookie = request.getHeader('Cookie');

### `request.getRawHeaderNames()`
<!-- YAML
added: v15.13.0
added:
- v15.13.0
- v14.17.0
-->

* Returns: {string[]}
Expand Down Expand Up @@ -2797,7 +2801,9 @@ This can be overridden for servers and client requests by passing the
<!-- YAML
added: v0.3.6
changes:
- version: v15.3.0
- version:
- v15.3.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36048
description: It is possible to abort a request with an AbortSignal.
- version:
Expand Down
12 changes: 9 additions & 3 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<!-- YAML
added: v8.4.0
changes:
- version: v15.3.0
- version:
- v15.3.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/36070
description: It is possible to abort a request with an AbortSignal.
- version: v15.0.0
Expand Down Expand Up @@ -1928,7 +1930,9 @@ value only affects new connections to the server, not any existing connections.

#### `server.updateSettings([settings])`
<!-- YAML
added: v15.1.0
added:
- v15.1.0
- v14.17.0
-->

* `settings` {HTTP/2 Settings Object}
Expand Down Expand Up @@ -2130,7 +2134,9 @@ value only affects new connections to the server, not any existing connections.

#### `server.updateSettings([settings])`
<!-- YAML
added: v15.1.0
added:
- v15.1.0
- v14.17.0
-->

* `settings` {HTTP/2 Settings Object}
Expand Down
4 changes: 3 additions & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,9 @@ filename.

### `module.isPreloading`
<!-- YAML
added: v15.4.0
added:
- v15.4.0
- v14.17.0
-->

* Type: {boolean} `true` if the module is running during the Node.js preload
Expand Down
1 change: 1 addition & 0 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,7 @@ added: v11.12.0
changes:
- version:
- v15.0.0
- v14.17.0
pr-url: https://github.com/nodejs/node/pull/35654
description: This API is no longer experimental.
-->
Expand Down
Loading

0 comments on commit 16e00a1

Please sign in to comment.