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

v12.16.1 proposal #31781

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.16.0">12.16.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.16.1">12.16.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.16.0">12.16.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.15.0">12.15.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.14.1">12.14.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.14.0">12.14.0</a><br/>
Expand Down
32 changes: 24 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,13 @@
parser.add_option('--use-largepages',
action='store_true',
dest='node_use_large_pages',
help='This option has no effect. --use-largepages is now a runtime option.')
help='build with Large Pages support. This feature is supported only on Linux kernel' +
'>= 2.6.38 with Transparent Huge pages enabled and FreeBSD')

parser.add_option('--use-largepages-script-lld',
action='store_true',
dest='node_use_large_pages_script_lld',
help='This option has no effect. --use-largepages is now a runtime option.')
help='link against the LLVM ld linker script. Implies -fuse-ld=lld in the linker flags')

intl_optgroup.add_option('--with-intl',
action='store',
Expand Down Expand Up @@ -1060,12 +1061,27 @@ def configure_node(o):
else:
o['variables']['node_use_dtrace'] = 'false'

if options.node_use_large_pages or options.node_use_large_pages_script_lld:
warn('''The `--use-largepages` and `--use-largepages-script-lld` options
have no effect during build time. Support for mapping to large pages is
now a runtime option of Node.js. Run `node --use-largepages` or add
`--use-largepages` to the `NODE_OPTIONS` environment variable once
Node.js is built to enable mapping to large pages.''')
if options.node_use_large_pages and not flavor in ('linux', 'freebsd', 'mac'):
raise Exception(
'Large pages are supported only on Linux, FreeBSD and MacOS Systems.')
if options.node_use_large_pages and flavor in ('linux', 'freebsd', 'mac'):
if options.shared or options.enable_static:
raise Exception(
'Large pages are supported only while creating node executable.')
if target_arch!="x64":
raise Exception(
'Large pages are supported only x64 platform.')
if flavor == 'mac':
info('macOS server with 32GB or more is recommended')
if flavor == 'linux':
# Example full version string: 2.6.32-696.28.1.el6.x86_64
FULL_KERNEL_VERSION=os.uname()[2]
KERNEL_VERSION=FULL_KERNEL_VERSION.split('-')[0]
if KERNEL_VERSION < "2.6.38" and flavor == 'linux':
raise Exception(
'Large pages need Linux kernel version >= 2.6.38')
o['variables']['node_use_large_pages'] = b(options.node_use_large_pages)
o['variables']['node_use_large_pages_script_lld'] = b(options.node_use_large_pages_script_lld)

if options.no_ifaddrs:
o['defines'] += ['SUNOS_NO_IFADDRS']
Expand Down
17 changes: 0 additions & 17 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,22 +881,6 @@ environment variables.

See `SSL_CERT_DIR` and `SSL_CERT_FILE`.

### `--use-largepages=mode`
<!-- YAML
added: v12.16.0
-->

Re-map the Node.js static code to large memory pages at startup. If supported on
the target system, this will cause the Node.js static code to be moved onto 2
MiB pages instead of 4 KiB pages.

The following values are valid for `mode`:
* `off`: No mapping will be attempted. This is the default.
* `on`: If supported by the OS, mapping will be attempted. Failure to map will
be ignored and a message will be printed to standard error.
* `silent`: If supported by the OS, mapping will be attempted. Failure to map
will be ignored and will not be reported.

### `--v8-options`
<!-- YAML
added: v0.1.3
Expand Down Expand Up @@ -1153,7 +1137,6 @@ Node.js options that are allowed are:
* `--track-heap-objects`
* `--unhandled-rejections`
* `--use-bundled-ca`
* `--use-largepages`
* `--use-openssl-ca`
* `--v8-pool-size`
* `--zero-fill-buffers`
Expand Down
25 changes: 0 additions & 25 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,6 @@ myEmitter.emit('error', new Error('whoops!'));
// Prints: whoops! there was an error
```

It is possible to monitor `'error'` events without consuming the emitted error
by installing a listener using the symbol `errorMonitor`.

```js
const myEmitter = new MyEmitter();
myEmitter.on(EventEmitter.errorMonitor, (err) => {
MyMonitoringTool.log(err);
});
myEmitter.emit('error', new Error('whoops!'));
// Still throws and crashes Node.js
```

## Capture Rejections of Promises

> Stability: 1 - captureRejections is experimental.
Expand Down Expand Up @@ -360,19 +348,6 @@ the event emitter instance, the event’s name and the number of attached
listeners, respectively.
Its `name` property is set to `'MaxListenersExceededWarning'`.

### `EventEmitter.errorMonitor`
<!-- YAML
added: v12.16.0
-->

This symbol shall be used to install a listener for only monitoring `'error'`
events. Listeners installed using this symbol are called before the regular
`'error'` listeners are called.

Installing a listener using this symbol does not change the behavior once an
`'error'` event is emitted, therefore the process will still crash if no
regular `'error'` listener is installed.

### `emitter.addListener(eventName, listener)`
<!-- YAML
added: v0.1.26
Expand Down
64 changes: 64 additions & 0 deletions doc/changelogs/CHANGELOG_V12.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</tr>
<tr>
<td valign="top">
<a href="#12.16.1">12.16.1</a><br/>
<a href="#12.16.0">12.16.0</a><br/>
<a href="#12.15.0">12.15.0</a><br/>
<a href="#12.14.1">12.14.1</a><br/>
Expand Down Expand Up @@ -53,6 +54,69 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)

<a id="12.16.1"></a>
## 2020-02-18, Version 12.16.1 'Erbium' (LTS), @MylesBorins

### Notable changes

Node.js 12.16.0 included 6 regressions that are being fixed in this release

**Accidental Unflagging of Self Resolving Modules**:

12.16.0 included a large update to the ESM implementation. One of the new features,
Self Referential Modules, was accidentally released without requiring the `--experimental-modules`
flag. This release is being made to appropriately flag the feature.

**Process Cleanup Changed Introduced WASM-Related Assertion**:

A change during Node.js process cleanup led to a crash in combination with
specific usage of WASM. This has been fixed by partially reverted said change.
A regression test and a full fix are being worked on and will likely be included
in future 12.x and 13.x releases.

**Use Largepages Runtime Option Introduced Linking Failure**:

A Semver-Minor change to introduce `--use-largepages` as a runtime option
introduced a linking failure. This had been fixed in master but regressed as the fix has not yet gone out
in a Current release. The feature has been reverted, but will be able to reland with a fix in a future
Semver-Minor release.

**Async Hooks was Causing an Exception When Handling Errors**:

Changes in async hooks internals introduced a case where an internal api call could be called with undefined
causing a process to crash. The change to async hooks was reverted. A regression test and fix has been proposed
and the change could re-land in a future Semver-Patch release if the regression is reliably fixed.

**New Enumerable Read-Only Property on EventEmitter breaks @types/extend**

A new property for enumerating events was added to the EventEmitter class. This
broke existing code that was using the `@types/extend` module for extending classses
as `@types/extend` was attemping to write over the existing field which the new
change made read-only. As this is the first property on EventEmitter that is
read-only this feature could be considered Semver-Major. The new feature has been
reverted but could re-land in a future Semver-Minor release if a non breaking way
of applying it is found.

**Exceptions in the HTTP parser were not emitting an uncaughtException**

A refactoring to Node.js interanls resulted in a bug where errors in the HTTP
parser were not being emitted by `process.on('uncaughtException')` when the `async_hooks` `after`
hook exists. The fix to this bug has been included in this release.

### Commits

* [[`51fdd759b9`](https://github.com/nodejs/node/commit/51fdd759b9)] - **async_hooks**: ensure event after been emitted on runInAsyncScope (legendecas) [#31784](https://github.com/nodejs/node/pull/31784)
* [[`7a1b0ac06f`](https://github.com/nodejs/node/commit/7a1b0ac06f)] - ***Revert*** "**build**: re-introduce --use-largepages as no-op" (Myles Borins) [#31782](https://github.com/nodejs/node/pull/31782)
* [[`a53eeca2a9`](https://github.com/nodejs/node/commit/a53eeca2a9)] - ***Revert*** "**build**: switch realpath to pwd" (Myles Borins) [#31782](https://github.com/nodejs/node/pull/31782)
* [[`6d432994e6`](https://github.com/nodejs/node/commit/6d432994e6)] - ***Revert*** "**build**: warn upon --use-largepages config option" (Myles Borins) [#31782](https://github.com/nodejs/node/pull/31782)
* [[`a5bc00af12`](https://github.com/nodejs/node/commit/a5bc00af12)] - ***Revert*** "**events**: allow monitoring error events" (Myles Borins)
* [[`f0b2d875d9`](https://github.com/nodejs/node/commit/f0b2d875d9)] - **module**: 12.x self resolve flag as experimental modules (Guy Bedford) [#31757](https://github.com/nodejs/node/pull/31757)
* [[`42b68a4e24`](https://github.com/nodejs/node/commit/42b68a4e24)] - **src**: inform callback scopes about exceptions in HTTP parser (Anna Henningsen) [#31801](https://github.com/nodejs/node/pull/31801)
* [[`065a32f064`](https://github.com/nodejs/node/commit/065a32f064)] - ***Revert*** "**src**: make --use-largepages a runtime option" (Myles Borins) [#31782](https://github.com/nodejs/node/pull/31782)
* [[`3d5beebc62`](https://github.com/nodejs/node/commit/3d5beebc62)] - ***Revert*** "**src**: make large\_pages node.cc include conditional" (Myles Borins) [#31782](https://github.com/nodejs/node/pull/31782)
* [[`43d02e20e0`](https://github.com/nodejs/node/commit/43d02e20e0)] - **src**: keep main-thread Isolate attached to platform during Dispose (Anna Henningsen) [#31795](https://github.com/nodejs/node/pull/31795)
* [[`7a5954ef26`](https://github.com/nodejs/node/commit/7a5954ef26)] - **src**: fix -Winconsistent-missing-override warning (Colin Ihrig) [#30549](https://github.com/nodejs/node/pull/30549)

<a id="12.16.0"></a>
## 2020-02-11, Version 12.16.0 'Erbium' (LTS), @targos

Expand Down
10 changes: 0 additions & 10 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -421,16 +421,6 @@ See
and
.Ev SSL_CERT_FILE .
.
.It Fl -use-largepages Ns = Ns Ar mode
Re-map the Node.js static code to large memory pages at startup. If supported on
the target system, this will cause the Node.js static code to be moved onto 2
MiB pages instead of 4 KiB pages.
.Pp
.Ar mode
must have one of the following values:
`off` (the default value, meaning do not map), `on` (map and ignore failure,
reporting it to stderr), or `silent` (map and silently ignore failure).
.
.It Fl -v8-options
Print V8 command-line options.
.
Expand Down
15 changes: 10 additions & 5 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
executionAsyncId,
triggerAsyncId,
// Private API
hasAsyncIdStack,
getHookArrays,
enableHooks,
disableHooks,
Expand Down Expand Up @@ -172,12 +173,16 @@ class AsyncResource {
const asyncId = this[async_id_symbol];
emitBefore(asyncId, this[trigger_async_id_symbol]);

const ret = thisArg === undefined ?
fn(...args) :
ReflectApply(fn, thisArg, args);
try {
const ret = thisArg === undefined ?
fn(...args) :
ReflectApply(fn, thisArg, args);

emitAfter(asyncId);
return ret;
return ret;
} finally {
if (hasAsyncIdStack())
emitAfter(asyncId);
}
}

emitDestroy() {
Expand Down
14 changes: 2 additions & 12 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const {
} = require('internal/util/inspect');

const kCapture = Symbol('kCapture');
const kErrorMonitor = Symbol('events.errorMonitor');

function EventEmitter(opts) {
EventEmitter.init.call(this, opts);
Expand Down Expand Up @@ -90,13 +89,6 @@ ObjectDefineProperty(EventEmitter, 'captureRejections', {
enumerable: true
});

ObjectDefineProperty(EventEmitter, 'errorMonitor', {
value: kErrorMonitor,
writable: false,
configurable: true,
enumerable: true
});

// The default for captureRejections is false
ObjectDefineProperty(EventEmitter.prototype, kCapture, {
value: false,
Expand Down Expand Up @@ -270,11 +262,9 @@ EventEmitter.prototype.emit = function emit(type, ...args) {
let doError = (type === 'error');

const events = this._events;
if (events !== undefined) {
if (doError && events[kErrorMonitor] !== undefined)
this.emit(kErrorMonitor, ...args);
if (events !== undefined)
doError = (doError && events.error === undefined);
} else if (!doError)
else if (!doError)
return false;

// If there is no 'error' event listener then throw.
Expand Down
1 change: 1 addition & 0 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ function resolveBasePath(basePath, exts, isMain, trailingSlash, request) {
}

function trySelf(parentPath, isMain, request) {
if (!experimentalModules) return false;
const { data: pkg, path: basePath } = readPackageScope(parentPath) || {};
if (!pkg || pkg.exports === undefined) return false;
if (typeof pkg.name !== 'string') return false;
Expand Down
5 changes: 3 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,10 @@
}],
],
}],
[ 'OS in "linux freebsd mac" and '
'target_arch=="x64"', {
[ 'node_use_large_pages=="true" and OS in "linux freebsd mac"', {
'defines': [ 'NODE_ENABLE_LARGE_CODE_PAGES=1' ],
# The current implementation of Large Pages is under Linux.
# Other implementations are possible but not currently supported.
'sources': [
'src/large_pages/node_large_page.cc',
'src/large_pages/node_large_page.h'
Expand Down
10 changes: 6 additions & 4 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,20 @@
}],
[ 'OS=="linux" and '
'target_arch=="x64" and '
'llvm_version=="0.0"', {
'node_use_large_pages=="true" and '
'node_use_large_pages_script_lld=="false"', {
'ldflags': [
'-Wl,-T',
'<!(echo "$(pwd)/src/large_pages/ld.implicit.script")',
'<!(realpath src/large_pages/ld.implicit.script)',
]
}],
[ 'OS=="linux" and '
'target_arch=="x64" and '
'llvm_version!="0.0"', {
'node_use_large_pages=="true" and '
'node_use_large_pages_script_lld=="true"', {
'ldflags': [
'-Wl,-T',
'<!(echo "$(pwd)/src/large_pages/ld.implicit.script.lld")',
'<!(realpath src/large_pages/ld.implicit.script.lld)',
]
}],
[ 'node_use_openssl=="true"', {
Expand Down
Loading