The call to url was not necessary since the `url` module itself was
already taking care of this.
PR-URL: https://github.com/nodejs/node/pull/20567
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This makes sure the async hooks and more is only loaded in case it
is actually necessary.
PR-URL: https://github.com/nodejs/node/pull/20567
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
The array was only used to create a key. Instead of allocating that
first, just directly create the necessary string.
PR-URL: https://github.com/nodejs/node/pull/20567
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured
when the parser detects that the port passed is the default port
for that scheme.
PR-URL: https://github.com/nodejs/node/pull/20479
Fixes: https://github.com/nodejs/node/issues/20465
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit aims to reduce some code duplication in state.js
PR-URL: https://github.com/nodejs/node/pull/20415
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
cp.exec decide to use `_stdout`(_stdout is string) or
`Buffer.concat(_stdout)`(_stdout is buffer array) by options.encoding.
but std(out|err) encoding can be changed. If encoding is changed to
not null, `_stdout` will become string, and `Buffer.concat(_stdout)`
will throw TypeError. This patch will fix it, use
options.encoding and `std(out|err)._readableState.encoding`.
PR-URL: https://github.com/nodejs/node/pull/18976
Fixes: https://github.com/nodejs/node/issues/18969
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Upstream deprecated them and moved them into categories of their own.
Add those categories to the export list. Node.js doesn't use them but
some add-ons do.
Fixes: https://github.com/nodejs/node/issues/20369
PR-URL: https://github.com/nodejs/node/pull/20712
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias NieÃen <tniessen@tnie.de>
Currently the following compiler warnings are generated:
../src/node_zlib.cc:222:8:
warning: 'DoThreadPoolWork' overrides a member function but is not marked
'override' [-Winconsistent-missing-override]
void DoThreadPoolWork() {
^
../src/node_internals.h:509:16: note: overridden virtual function is here
virtual void DoThreadPoolWork() = 0;
^
../src/node_zlib.cc:357:8: warning:
'AfterThreadPoolWork' overrides a member function but is not marked
'override' [-Winconsistent-missing-override]
void AfterThreadPoolWork(int status) {
^
../src/node_internals.h:510:16:
note: overridden virtual function is here
virtual void AfterThreadPoolWork(int status) = 0;
^
This commit adds the override specifier to the methods to silence the
warnings.
PR-URL: https://github.com/nodejs/node/pull/20769
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/20785
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This change adds a new inspector domain for receiving Node tracing
data.
1. Node.js now can extend Inspector protocol with new domains with
the API defined in the src/inspector/node_protocol.pdl.
2. Plumbing code will be generated at the build time. /json/protocol
HTTP endpoint returns both V8 and Node.js inspector protocol.
3. "NodeTracing" domain was introduced. It is based on the Chrome
"Tracing" domain.
PR-URL: https://github.com/nodejs/node/pull/20608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Original commit message:
Custom tag for the traceEvents array
This API will be used by Node.js to provide output compatible with
Chrome devtools.
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I265495f8af39bfc78d7fdbe43ac308f0920e817d
Reviewed-on: https://chromium-review.googlesource.com/1044491
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Eugene Ostroukhov <eostroukhov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53041}
PR-URL: https://github.com/nodejs/node/pull/20608
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
The references in the COLLABORATOR_GUIDE appear to be in no particular
order. Sort in ASCII order.
PR-URL: https://github.com/nodejs/node/pull/20790
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Original commit message:
ThreadDataTable: Change global linked list to per-Isolate hash map.
For use cases with a large number of threads or a large number of
isolates (or both), ThreadDataTable can be a major performance
bottleneck due to O(n) lookup time of the linked list. Switching to a
hash map reduces this to O(1).
Example 1: Sandstorm.io, a Node.js app that utilizes "fibers", was
observed spending the majority of CPU time iterating over the
ThreadDataTable.
See: https://sandstorm.io/news/2016-09-30-fiber-bomb-debugging-story
Example 2: Cloudflare's Workers engine, a high-multi-tenancy web
server framework built on V8 (but not Node), creates large numbers of
threads and isolates per-process. It saw a 34x improvement in
throughput when we applied this patch.
Cloudflare has been using a patch in production since the Worker
launch which replaces the linked list with a hash map -- but still
global.
This commit builds on that but goes further and creates a separate
hash map and mutex for each isolate, with the table being a member of
the Isolate class. This avoids any globals and should reduce lock
contention.
Bug: v8:5338
Change-Id: If0d11509afb2e043b888c376e36d3463db931b47
Reviewed-on: https://chromium-review.googlesource.com/1014407
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52753}
PR-URL: https://github.com/nodejs/node/pull/20727
Ref: https://github.com/nodejs/node/issues/20083
Refs: https://github.com/nodejs/node/issues/20083
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
1. Do not autolink in doc stability section.
2. Do not add void wrapping elements to docs.
PR-URL: https://github.com/nodejs/node/pull/20731
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Adjust http2 behaviour to allow ending a stream even after some
data comes in (when the user has no intention of reading that
data). Also correctly end a stream when trailers are present.
PR-URL: https://github.com/nodejs/node/pull/20621
Fixes: https://github.com/nodejs/node/issues/20060
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Apply the first of five test cases in test-fs-append-file to the
promise-based API in addition to the callback-based API.
PR-URL: https://github.com/nodejs/node/pull/20739
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add basic trace events for node_contextify. These generally
align very well with V8.ScriptCompile and V8.ScriptExecute
trace events and provide good additional context. For instance,
using the node.vm.script trace category at startup allows us to
see exactly how long compilation and init of each of our core
modules adds to the startup time.
PR-URL: https://github.com/nodejs/node/pull/20728
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Update CODEOWNERS entry for README.md to only apply to the top level
README.md. For example, if test/common/README.md is updated, that should
not be assigned to TSC automatically.
PR-URL: https://github.com/nodejs/node/pull/20729
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit adds a constant named defaultModuleName to avoid duplicating
it in the Module constructor function.
PR-URL: https://github.com/nodejs/node/pull/20709
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
There really isn’t any good reason for these to be static methods,
it just adds one layer of indirection (when reading the code,
not in a way that affects behaviour).
Addresses a `TODO` comment introduced in c072057049.
PR-URL: https://github.com/nodejs/node/pull/20674
Refs: c072057049
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Later rules take precedence over earlier rules, so move all rules that
assign ownership to TSC to the end of the file. There are likely other
reorderings that we will want to consider.
PR-URL: https://github.com/nodejs/node/pull/20732
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This bug needs a test case with a high goldilocks factor to trigger
but the synopsis is that `v8::TryCatch::Message()` returns an empty
handle when the TryCatch is declared at a time when an exception is
already pending.
We now recompute the message inside `node::ReportException()` and
all is well again.
PR-URL: https://github.com/nodejs/node/pull/20708
Fixes: https://github.com/nodejs/node/issues/8854
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Check actual expired time rather than relying on a number of calls to
setTimeout() in test-http2-session-timeout more robust.
PR-URL: https://github.com/nodejs/node/pull/20692
Fixes: https://github.com/nodejs/node/issues/20628
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/20374
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Check for platform support first to save a level of indentation.
PR-URL: https://github.com/nodejs/node/pull/20551
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Currently, assertion messages are implicitly converted to strings,
which causes symbols to throw. This commit adds an explicit
string conversion.
PR-URL: https://github.com/nodejs/node/pull/20693
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
When test/parallel/test-assert-checktag.js is run with a TTY
as stdout, color codes in assertion messages cause the test to
fail. This commit disables colors when stdout is a TTY.
PR-URL: https://github.com/nodejs/node/pull/20695
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>