Matteo Collina
696f063c5e
http,https: protect against slow headers attack
...
CVE-2018-12122
An attacker can send a char/s within headers and exahust the resources
(file descriptors) of a system even with a tight max header length
protection. This PR destroys a socket if it has not received the headers
in 40s.
PR-URL: https://github.com/nodejs-private/node-private/pull/151
Ref: https://github.com/nodejs-private/node-private/pull/144
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-11-27 15:07:09 +11:00
Bastian Krol
26d145a77f
async_hooks: add missing async_hooks destroys in AsyncReset
...
This adds missing async_hooks destroy calls for sockets (in
_http_agent.js) and HTTP parsers. We need to emit a destroy in
AsyncWrap#AsyncReset before assigning a new async_id when the instance
has already been in use and is being recycled, because in that case, we
have already emitted an init for the "old" async_id.
This also removes a duplicated init call for HTTP parser: Each time a
new parser was created, AsyncReset was being called via the C++ Parser
class constructor (super constructor AsyncWrap) and also via
Parser::Reinitialize.
Backport-PR-URL: https://github.com/nodejs/node/pull/23410
PR-URL: https://github.com/nodejs/node/pull/23272
Fixes: https://github.com/nodejs/node/issues/19859
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-11-04 12:35:10 +00:00
Santiago Gimeno
1d90700514
child_process: fix stdio sockets creation
...
`readable` and `writable` properties can be passed directly to the
`net.Socket` constructor. This change also avoids an unnecessary call
to `read(0)` on the `stdin` socket. This behavior was disclosed when
trying to merge `libuv@1.19 .0` and specifically this commit:
https://github.com/libuv/libuv/commit/fd049399aa4ed8495928e375466970d98cb42e17 .
PR-URL: https://github.com/nodejs/node/pull/18701
Refs: https://github.com/libuv/libuv/pull/1655
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-08-16 11:38:53 +10:00
Anna Henningsen
3d38bab64e
net: use _final instead of on('finish')
...
Shutting down the connection is what `_final` is there for.
PR-URL: https://github.com/nodejs/node/pull/18608
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-08-16 11:38:51 +10:00
Ali Ijaz Sheikh
daacff8584
async_hooks: deprecate unsafe emit{Before,After}
...
The emit{Before,After} APIs in AsyncResource are problematic.
* emit{Before,After} are named to suggest that the only thing they do
is emit the before and after hooks. However, they in fact, mutate
the current execution context.
* They must be properly nested. Failure to do so by user code leads
to catastrophic (unrecoverable) exceptions. It is very easy for the
users to forget that they must be using a try/finally block around
the code that must be surrounded by these operations. Even the
example provided in the official docs makes this mistake. Failing
to use a finally can lead to a catastrophic crash if the callback
ends up throwing.
This change provides a safer `runInAsyncScope` API as an alternative
and deprecates emit{Before,After}.
Backport-PR-URL: https://github.com/nodejs/node/pull/19517
PR-URL: https://github.com/nodejs/node/pull/18513
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
2018-08-16 11:38:50 +10:00
Rich Trott
7d263ff708
test: fix unreliable async-hooks/test-signalwrap
...
Use an interval to keep the event loop open so the test does not exit
before receiving all signals fom asynchronous `exec()` calls.
PR-URL: https://github.com/nodejs/node/pull/17827
Fixes: https://github.com/nodejs/node/issues/14070
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
2018-08-16 11:38:48 +10:00
Roman Reiss
5e4f9b37ba
src,doc,test: Fix common misspellings
...
Backport-PR-URL: https://github.com/nodejs/node/pull/20456
PR-URL: https://github.com/nodejs/node/pull/18151
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-05-02 14:30:43 -04:00
Rich Trott
53b702fdba
test: remove common.PORT from parallel tests
...
`common.PORT` should not be used in parallel tests because another test
may experience a collision with `common.PORT` when using port 0 to get
an open port. This has been observed to result in test failures in CI.
PR-URL: https://github.com/nodejs/node/pull/17410
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Lance Ball <lball@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2018-04-12 01:11:36 +01:00
Rich Trott
a1b0d5da07
test: move tmpdir to submodule of common
...
Move tmpdir functionality to its own module (common/tmpdir).
Backport-PR-URL: https://github.com/nodejs/node/pull/19488
PR-URL: https://github.com/nodejs/node/pull/17856
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-03-29 23:28:22 -04:00
Tobias Nießen
1043b6fd7c
test: fix spelling in test case comments
...
Backport-PR-URL: https://github.com/nodejs/node/pull/19118
PR-URL: https://github.com/nodejs/node/pull/18018
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2018-03-29 23:28:21 -04:00
Andreas Madsen
0211175bc7
async_hooks,test: only use IPv6 in http test
...
If IPv6 is not supported on a machine, the IPv6 handle will first be
created, this will then fail and default to an IPv4 handle. This causes
the graph to change, as there now is an extra handle.
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
PR-URL: https://github.com/nodejs/node/pull/18143
Fixes: https://github.com/nodejs/node/issues/18003
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-01-19 13:14:36 -05:00
Andreas Madsen
91d4eb5ff8
async_hooks,http: set HTTPParser trigger to socket
...
This allows more easy tracking of where HTTP requests come from. Before
this change the HTTPParser would have the HTTPServer as the
triggerAsyncId.
The HTTPParser will still have the executionAsyncId set to the HTTP
Server so that information is still directly available. Indirectly, the
TCP socket itself also has its triggerAsyncId set to the TCP Server.
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
PR-URL: https://github.com/nodejs/node/pull/18003
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: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2018-01-19 13:14:34 -05:00
Andreas Madsen
6d55a4c941
async_wrap: add provider types for net server
...
Adds `TCPSERVERWRAP` and `PIPESERVERWRAP` as provider types. This
makes it possible to distinguish servers from connections.
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
PR-URL: #17157
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-01-19 13:14:10 -05:00
Anna Henningsen
e67448813f
src: remove async_hooks destroy timer handle
...
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
PR-URL: https://github.com/nodejs/node/pull/17117
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-01-19 13:14:05 -05:00
Andreas Madsen
025b9f208f
async_hooks: deprecate undocumented API
...
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
PR-URL: https://github.com/nodejs/node/pull/16972
Refs: https://github.com/nodejs/node/issues/14328
Refs: https://github.com/nodejs/node/issues/15572
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-01-19 13:14:00 -05:00
Sebastian Mayr
36dbd1181a
async_hooks: add destroy event for gced AsyncResources
...
In cases where libraries create AsyncResources which may be emitting
more events depending on usage, the only way to ensure that destroy is
called properly is by calling it when the resource gets garbage
collected.
Backport-PR-URL: https://github.com/nodejs/node/pull/18179
Fixes: https://github.com/nodejs/node/issues/16153
PR-URL: https://github.com/nodejs/node/pull/16998
Fixes: https://github.com/nodejs/node/issues/16153
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-01-19 13:13:49 -05:00
Rich Trott
683daea419
test: fix flaky async-hooks/test-graph.signal
...
Make sure event loop remains open long enough for signal to be received.
PR-URL: https://github.com/nodejs/node/pull/17509
Fixes: https://github.com/nodejs/node/issues/14568
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2017-12-20 01:59:32 +00:00
Kurt Hsu
ef6d68c2f9
test: use common.crashOnUnhandledRejection
...
PR-URL: https://github.com/nodejs/node/pull/17229
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:59:14 +00:00
aryung chen
040fe7025a
test: use common.crashOnUnhandledRejection
...
PR-URL: https://github.com/nodejs/node/pull/17221
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:59:12 +00:00
Sean Karson
0ebded4376
test: show incorrect value on test failure
...
PR-URL: https://github.com/nodejs/node/pull/16818
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
2017-11-16 18:17:57 -05:00
Andreas Madsen
c9715bb9c2
async_hooks: skip runtime checks when disabled
...
PR-URL: https://github.com/nodejs/node/pull/15454
Ref: https://github.com/nodejs/node/pull/14387
Ref: https://github.com/nodejs/node/pull/14722
Ref: https://github.com/nodejs/node/issues/14717
Ref: https://github.com/nodejs/node/issues/15448
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-10-23 17:18:17 -04:00
Rob Adelmann
11b775beb6
async_hooks: replace concat w template literals
...
updated test/async-hooks/init-hooks.js
PR-URL: https://github.com/nodejs/node/pull/15968
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-17 23:27:06 -07:00
Rich Trott
1e79a06ac6
test: fix flaky async-hooks/test-tlswrap
...
There is a race condition in async-hooks/test-tlswrap. This addresses it
by waiting 5 more ticks if the client has not been destroyed yet.
PR-URL: https://github.com/nodejs/node/pull/15744
Fixes: https://github.com/nodejs/node/issues/14404
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-10-11 02:05:42 -04:00
Rich Trott
22ea3a8cd2
test: remove common.PORT from test-tlswrap
...
`test/async-hooks/test/test-tlswrap.js` uses `common.PORT` but
async-hooks tests are run in parallel. Another test using port 0 could
result in a port collision. Remove `common.PORT` from the test.
PR-URL: https://github.com/nodejs/node/pull/15742
Ref: https://github.com/nodejs/node/issues/14404#issuecomment-333672346
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-11 02:05:42 -04:00
James M Snell
91e96d8f08
lib,src: fix consistent spacing inside braces
...
PR-URL: #14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-20 12:32:17 -07:00
James M Snell
81723a9172
async_hooks,doc: some async_hooks improvements
...
Update docs and type checking for AsyncResource type
PR-URL: https://github.com/nodejs/node/pull/15103
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-09-20 09:23:00 -07:00
Miguel Angel Asencio Hurtado
ae91b1efc0
test: continue normalizing fixtures use
...
PR-URL: https://github.com/nodejs/node/pull/14716
Refs: https://github.com/nodejs/node/pull/14332
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2017-09-12 03:18:34 +02:00
Trevor Norris
b40105df3b
async_hooks: don't abort unnecessarily
...
* id values of -1 are allowed. They indicate that the id was never
correctly assigned to the async resource. These will appear in any
call graph, and will only be apparent to those using the async_hooks
module, then reported in an issue.
* ids < -1 are still not allowed and will cause the application to
exit the process; because there is no scenario where this should ever
happen.
* Add asyncId range checks to emitAfterScript().
* Fix emitBeforeScript() range checks which should have been || not &&.
* Replace errors with entries in internal/errors.
* Fix async_hooks tests that check for exceptions to match new
internal/errors entries.
NOTE: emit{Before,After,Destroy}() must continue to exit the process
because in the case of an exception during hook execution the state of
the application is unknowable. For example, an exception could cause a
memory leak:
const id_map = new Map();
before(id) {
id_map.set(id, /* data object or similar */);
},
after(id) {
throw new Error('id never dies!');
id_map.delete(id);
}
Allowing a recoverable exception may also cause an abort because of a
stack check in Environment::AsyncHooks::pop_ids() that verifies the
async id and pop'd ids match. This case would be more difficult to debug
than if fatalError() (lib/async_hooks.js) was called immediately.
try {
async_hooks.emitBefore(null, NaN);
} catch (e) { }
// do something
async_hooks.emitAfter(5);
It also allows an edge case where emitBefore() could be called twice and
not have the pop_ids() CHECK fail:
try {
async_hooks.emitBefore(5, NaN);
} catch (e) { }
async_hooks.emitBefore(5);
// do something
async_hooks.emitAfter(5);
There is the option of allowing mismatches in the stack and ignoring the
check if no async hooks are enabled, but I don't believe going this far
is necessary.
PR-URL: https://github.com/nodejs/node/pull/14722
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-09-12 03:18:31 +02:00
Simon Brewster
5b13add028
test: remove unused param in test-graph.pipe
...
Refs: https://twitter.com/NodeTodo/status/900502354834800645
PR-URL: https://github.com/nodejs/node/pull/15007
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-09-12 03:18:17 +02:00
Mohd Maqbool Alam
d4c2eba376
test: remove unused function args
...
PR-URL: https://github.com/nodejs/node/pull/14971
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: David Cai <davidcai1993@yahoo.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-12 03:17:15 +02:00
Bartosz Sosnowski
8c927dd71f
test: fix async-hooks tests
...
The 'test-graph.tcp' and 'test-tcpwrap' tests are using '::' as server
address. This is mapped to localhost on Linux, but fails on Windows.
PR-URL: https://github.com/nodejs/node/pull/14865
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-09-12 03:17:14 +02:00
Runite618
4dd095c982
test: refactor async-hooks/test-httparser tests
...
CRLF variable was defined but only used on line 22 so the variable
was deleted and placed inside line 22 as a string literal. This
was in file test-httpparser.request.js
On line 46 there's a function declared that takes 3 arguments but
none of them are ever used so removed. This is in file
test-httpparser.response.js
PR-URL: https://github.com/nodejs/node/pull/14818
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-09-12 03:16:55 +02:00
Miguel Angel Asencio Hurtado
55aba6aee7
test: replace indexOf with includes
...
Refs: https://github.com/nodejs/node/issues/12586
PR-URL: https://github.com/nodejs/node/pull/14630
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
2017-08-10 18:20:49 +02:00
Anna Henningsen
8a3bc874fa
src: fix process.abort() interaction with V8
...
Since V8 5.9 V8 installs a default signal handler for some signals
when creating a default platform instance that prints a stack trace.
However, Node already does the same thing, so it would seem like the
two different stack traces would be printed; also, the V8 handler
would lead to a `SIGSEGV` under some circumstances, rather than
letting the abort continue normally.
Resolve this by disabling V8’s signal handler by default.
Backport-PR-URL: https://github.com/nodejs/node/pull/14574
Backport-Reviewed-By: Anna Henningsen <anna@addaleax.net >
Backport-Reviewed-By: Refael Ackermann <refack@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/13985
Fixes: https://github.com/nodejs/node/issues/13865
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-08-02 12:22:25 +02:00
Rich Trott
7c51240b1a
test: adjust indentation for stricter linting
...
ESLint 4.x has stricter linting than previous versions. We are currently
using the legacy indentation rules in the test directory. This commit
changes the indentation of files to comply with the stricter 4.x linting
and enable stricter linting in the test directory.
Backport-PR-URL: https://github.com/nodejs/node/pull/14522
Backport-Reviewed-By: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/14431
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2017-07-28 02:31:59 +02:00
erdun
23cd934d71
test: refactor test-httpparser.response.js
...
* replace CRLF constant with '\r\n' literal
* fix typo in HTTP header name
PR-URL: https://github.com/nodejs/node/pull/14290
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-07-28 00:22:36 +02:00
Song, Bintao Garfield
265f159881
test: replace concatenation with template literals
...
Replace string concatenation in test/async-hooks/test-signalwrap.js
with template literals.
PR-URL: https://github.com/nodejs/node/pull/14295
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-07-24 17:44:28 +02:00
Vincent Xue
3c92b787d7
test: use path.join in async-hooks/test-tlswrap.js
...
PR-URL: https://github.com/nodejs/node/pull/14319
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2017-07-24 10:58:24 -04:00
jkzing
94c7331277
test: replace string concatenation with path.join
...
PR-URL: https://github.com/nodejs/node/pull/14272
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2017-07-24 10:58:23 -04:00
Matteo Collina
302c19b006
process: triggerAsyncId can be undefined
...
Fixes: https://github.com/nodejs/node/issues/14386
Fixes: https://github.com/nodejs/node/issues/14381
PR-URL: https://github.com/nodejs/node/pull/14387
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2017-07-20 16:18:14 -04:00
vercent deng
bf55439828
test: use template literals in test-writewrap
...
Use template literals instead of string concatenation in
test/async-hooks/test-writewrap.js.
PR-URL: https://github.com/nodejs/node/pull/14292
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2017-07-19 15:02:47 -04:00
weiyuanyue
d02f2b9f28
test: replace string concatenation with template
...
Replace string concatenation with template literals in
test/async-hooks/verify-graph.js.
PR-URL: https://github.com/nodejs/node/pull/14279
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-07-19 15:02:46 -04:00
blade254353074
7c74402d3e
test: use template literals as appropriate
...
Replace string concatenation with template string literals in
test-graph.signal.js.
PR-URL: https://github.com/nodejs/node/pull/14289
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2017-07-19 15:02:45 -04:00
Andreas Madsen
7f87876cb7
async_hooks: make AsyncResource match emitInit
...
AsyncResource previously called emitInitNative. Since AsyncResource is
just an abstraction on top of the emitEventScript functions, it should
call emitInitScript instead.
PR-URL: https://github.com/nodejs/node/pull/14152
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-07-19 15:02:33 -04:00
Andreas Madsen
90a3b86e5d
async_hooks: fix nested hooks mutation
...
In some cases restoreTmpHooks is called too early, this causes
active_hooks_array to change during execution of the init hooks.
PR-URL: https://github.com/nodejs/node/pull/14143
Ref: https://github.com/nodejs/node/pull/14054#issuecomment-313915193
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-07-19 15:02:33 -04:00
Trevor Norris
292ad3061d
test,async_hooks: match test-ttywrap.readstream
...
Match changes made to test-ttywrap.readstream for consistency.
PR-URL: https://github.com/nodejs/node/pull/13991
Fixes: https://github.com/nodejs/node/issues/13984
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-07-19 15:02:30 -04:00
Trevor Norris
fc74f0ea65
test,async_hooks: skip whether TTY is available
...
If TTY isn't available then the test will always fail. Also use the
already available process.stdin instead of opening another ReadStream.
PR-URL: https://github.com/nodejs/node/pull/13991
Fixes: https://github.com/nodejs/node/issues/13984
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-07-19 15:02:29 -04:00
Andreas Madsen
8d3b34b3b7
async_hooks: use common emitBefore and emitAfter
...
Timers and nextTick have special emitBefore and emitAfter functions for
historic reasons. These function are not needed any more, thus the
public emitBefore and emitAfter function can be used.
PR-URL: https://github.com/nodejs/node/pull/14050
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-07-19 15:02:15 -04:00
Andreas Madsen
796881d749
async_hooks: fix default nextTick triggerAsyncId
...
In the case where triggerAsyncId is null it should default to the
current executionAsyncId. This worked but as a side-effect the resource
object was changed too.
This fix also makes the null check more strict. EmitInitS is not a
documented API, thus there is no reason to be flexible in its input.
Ref: https://github.com/nodejs/node/issues/13548#issuecomment-310985270
PR-URL: https://github.com/nodejs/node/pull/14026
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-07-19 15:02:11 -04:00
Matt Sergeant
3556031734
async-hooks,net: ensure asyncId=null if no handle
...
If the .listen() hasn't been called on the server, there is no handle
object. In this case use null as the triggerAsyncId.
Fixes: https://github.com/nodejs/node/issues/13548
PR-URL: https://github.com/nodejs/node/pull/13938
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
2017-07-19 15:02:10 -04:00