Notable Changes

Diagnostics channel (experimental module)

1
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

1
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

1
dc.channel(name)

and call

1
channel.publish(data)

to send the data to any listeners to that channel.


1
2
3
4
5
6
7
8
9
10
11
12
<span class="token keyword">const</span> dc <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'diagnostics_channel'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> channel <span class="token operator">=</span> dc<span class="token punctuation">.</span><span class="token function">channel</span><span class="token punctuation">(</span><span class="token string">'mysql.query'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token class-name">MySQL</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function-variable function">query</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token function">query</span><span class="token punctuation">(</span><span class="token parameter">queryString<span class="token punctuation">,</span> values<span class="token punctuation">,</span> callback</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token comment">// Broadcast query information whenever a query is made</span>
  channel<span class="token punctuation">.</span><span class="token function">publish</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    query<span class="token operator">:</span> queryString<span class="token punctuation">,</span>
    host<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>hostname<span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doQuery</span><span class="token punctuation">(</span>queryString<span class="token punctuation">,</span> values<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>

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

1
channel.subscribe(listener)

to run a function whenever a message is published to that channel.


1
2
3
4
5
6
<span class="token keyword">const</span> dc <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'diagnostics_channel'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> channel <span class="token operator">=</span> dc<span class="token punctuation">.</span><span class="token function">channel</span><span class="token punctuation">(</span><span class="token string">'mysql.query'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

channel<span class="token punctuation">.</span><span class="token function">subscribe</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> query<span class="token punctuation">,</span> host <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
  console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">mysql query to </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>host<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">: </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>query<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

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

1
crypto.randomUUID()

method now allows to generate random
RFC 4122 Version 4 UUID strings:


1
2
3
4
<span class="token keyword">const</span> <span class="token punctuation">{</span> randomUUID <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'crypto'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">randomUUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 'aa7c91a1-f8fc-4339-b9db-f93fc7233429'</span>

Contributed by James M Snell #36729.

Experimental support for

1
AbortController

and

1
AbortSignal


Node.js 14.17.0 adds experimental partial support for

1
AbortController

and

1
AbortSignal

.

Both constructors can be enabled globally using the

1
--experimental-abortcontroller

flag.

Additionally, several Node.js APIs have been updated to support

1
AbortSignal

for cancellation.
It is not mandatory to use the built-in constructors with them. Any spec-compliant third-party alternatives
should be compatible.

1
AbortSignal

support was added to the following methods:

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

    and

    1
    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

Commits

Windows 32-bit Installer: https://nodejs.org/dist/v14.17.0/node-v14.17.0-x86.msi
Windows 64-bit Installer: https://nodejs.org/dist/v14.17.0/node-v14.17.0-x64.msi
Windows 32-bit Binary: https://nodejs.org/dist/v14.17.0/win-x86/node.exe
Windows 64-bit Binary: https://nodejs.org/dist/v14.17.0/win-x64/node.exe
macOS 64-bit Installer: https://nodejs.org/dist/v14.17.0/node-v14.17.0.pkg
macOS Intel 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-x64.tar.gz
Linux 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz
Linux PPC LE 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-ppc64le.tar.xz
Linux s390x 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-s390x.tar.xz
AIX 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-aix-ppc64.tar.gz
ARMv7 32-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-armv7l.tar.xz
ARMv8 64-bit Binary: https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz
Source Code: https://nodejs.org/dist/v14.17.0/node-v14.17.0.tar.gz
Other release files: https://nodejs.org/dist/v14.17.0/
Documentation: https://nodejs.org/docs/v14.17.0/api/

SHASUMS


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

fb33407ea6518e5a839875d33a10948c01e36bbdba968831c861a2f5c1d5c3c2  node-v14.17.0-aix-ppc64.tar.gz
7b210652e11d1ee25650c164cf32381895e1dcb3e0ff1d0841d8abc1f47ac73e  node-v14.17.0-darwin-x64.tar.gz
5866a8b115a2b9deee5bf4114aa9d81f0f6077ca5d4258b7b07fb334e5ec8d03  node-v14.17.0-darwin-x64.tar.xz
cc143d20f827a9a307ee8c1a9c5c403d3d254690bf9329094cf679064990e456  node-v14.17.0-headers.tar.gz
3ac387f9ffa78cc845f38a1bf620a70a2e25fbd385093153eb88acdd7302298d  node-v14.17.0-headers.tar.xz
9d5948d4397815ce7a746618338f79ce5e7e91efec9c165140ba62fd6c17c07a  node-v14.17.0-linux-arm64.tar.gz
712e5575cee20570a0a56f4d4b4572cb0f2ee2f4bce49433de18be0393e7df22  node-v14.17.0-linux-arm64.tar.xz
66d629b911279d9223fb7c2afa153fe42c84998164d54ec6be42a60aa40705ca  node-v14.17.0-linux-armv7l.tar.gz
9f96c567e32acc1a9055e2881fdb7b8f42b909b87ada91ebc6b2f1acd6d451da  node-v14.17.0-linux-armv7l.tar.xz
7fdbc70cb3ef04886fb70c303c3b42efc572a9101b46a2b8377e8db005341213  node-v14.17.0-linux-ppc64le.tar.gz
b20a9d557b513a375d348ca84b8341e08c6d8d5936c0e1527160ecaa11794fab  node-v14.17.0-linux-ppc64le.tar.xz
6aacb480a8ba34af3de0e410ea6a3fd445b3945274da81a1f7551ca22f3d4afc  node-v14.17.0-linux-s390x.tar.gz
6419372b9e9ad37e0bce188dc5740f2f060aaa44454418e462b4088a310a1c0b  node-v14.17.0-linux-s390x.tar.xz
3d06eabc73ec8626337bff370474306eac1c3c21122f677720d154c556ceafaf  node-v14.17.0-linux-x64.tar.gz
494b161759a3d19c70e3172d33ce1918dd8df9ad20d29d1652a8387a84e2d308  node-v14.17.0-linux-x64.tar.xz
bce130481d66fe9e13cc7e04dd18963f0d78148347b8232ae7533eb09418477f  node-v14.17.0.pkg
6114e82d3256136dc85a509d835442fbdf2f8430dcd8bfa7c304097344d06fb7  node-v14.17.0.tar.gz
56e05bff9331039317db417f772e635e0cd1c55f733f7b1b079d71ab5842c9ed  node-v14.17.0.tar.xz
bfd45ff5065def2aa85e5da3c7e88035078c956286d9ea0220752ad98d6d28de  node-v14.17.0-win-x64.7z
6582a7259c433e9f667dcc4ed3e5d68bc514caba2eed40e4626c8b4c7e5ecd5c  node-v14.17.0-win-x64.zip
ce5f166bab925f9c6ae99c5f8f7b105bd98e20b3554a9016bf3dcb3c2746fa2d  node-v14.17.0-win-x86.7z
952f4fb7ed9e3e3a5eb5a53a94f78f3dd2d6ee809e61056fcbf39285ca0066d4  node-v14.17.0-win-x86.zip
6d4c7457a210b867ca5b1c4a4465b4065ae6708dfd917383fe61f6860dba2128  node-v14.17.0-x64.msi
c3d7bb267ead2548746092a7e31fb59cb7828d1fe9f97d9628ed6ea4977b4c35  node-v14.17.0-x86.msi
8ac595f56ab1db228db115ce69798b31151cbf169b889330ca0c5f10bd3b8839  win-x64/node.exe
f399504245cb54ce8717408fedb10417a0066f1532c37511bc32a4380a56da7b  win-x64/node.lib
10d06d2eed7f486316ba90b7e5f5d4e6c6def64fd29147685f98bdfaca11f992  win-x64/node_pdb.7z
070da7f1cafbd85e0a8008cd058e13b9f111f3858716094f74e5bcaf936889f0  win-x64/node_pdb.zip
e1afb960b95a31c4f1016718ea1d17f4d31a5c9fcc8474575dad41b7afecea1a  win-x86/node.exe
ccfea07933b62822ee8d1572b9e80bbfbbf664da7b4a18184c152ea98e6c32ae  win-x86/node.lib
8c266b2d93bd08690ed219ee3c9ad4fcd6c81a35ba9c803de9f27fc948f62766  win-x86/node_pdb.7z
f54d9181dac21835e00a64d8b530243c3a5db26c3267bb0b09744a94e515dc9a  win-x86/node_pdb.zip
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEdPEmArbxxOkT+qN606iWE2Q7YgEFAmCbD5kACgkQ06iWE2Q7
YgGHkhAAmAO+IHG8kKPyaBoKD9PpHnvdCzNIRFHgzeVNiO+uIYJD3h6qdGncUwd9
cxh303gy2VBUxXb6baKneNLOLF10hs6ETeemUWXUrfxDiNhC1iqc3izhojyBoSEv
6h/RpbPgSLDCKTH2unDa7FDW4niIeou7WCQNo/Y+7FDIXNBVZKxoByv03TSAjugU
JJROwUBTgGIEV7X4m1aF4YTii8sklNOU3UPLy6FuKX6I7Cf//AXuZYiiD8PN5/rL
gYOe++tExlj5Q3veESf5k6GAnMPtMkgVI51pj+de1JWhWNuAHzdJUhgmLvoXF4Pn
ILCRi8PuBsSD15CixodskeYoga+SP+MDAmOt23Qn5fNx5zAyADAk/cq2OpI7zFKH
eIcM4eBc6fbdZgRs9BMp55Mq2MVlgmcR10Z8RWMPT8251bK9m0nXhx73xUKuUg4O
LBvRn5RkUsFdh6WLod+F4udsp+wljKt5rbVsLPT9fH/QA9lbUcg4i5FoLjxwa9eP
Y2UscqyPN5rMhmMzmkpagKmRhWwPnLV497u6QdY1qefWqi0RoTeehuxX2JMCbAK5
Ehgtyns+NsY9Oqu2W192eonoUx73N6S+6OjK8enhtOZrROAGF8aioTtKcbo1qFZo
BZWMpsQ6UaCMSGP4+bkIo6WJgWxfcqRybsm3dJPCIy4OuWyZgko=
=7SvM
-----END PGP SIGNATURE-----
Categories: NewsReleases

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *