Anatoli Papirovski
4de31d517f
async_hooks: remove internal only error checking
...
This error checking is mostly unnecessary and is just a Node core
developer nicety, rather than something that is needed for the
user-land. It can be safely removed without any practical
impact while making nextTick, timers, immediates and AsyncResource
substantially faster.
PR-URL: https://github.com/nodejs/node/pull/30967
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2020-01-11 19:20:45 -08:00
Anatoli Papirovski
1fab8a9297
timers: fix refresh for expired timers
...
Expired timers were not being refresh correctly and
would always act as unrefed if refresh was called.
PR-URL: https://github.com/nodejs/node/pull/27345
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-25 12:45:24 +01:00
Anatoli Papirovski
0b89761d6d
timers: do less work in insert
...
Most of the code in insert is only applicable to scheduling
non-timers or re-scheduling timers. We can skip most of it
in the case of setTimeout, setInterval & setUnrefTimeout.
PR-URL: https://github.com/nodejs/node/pull/27345
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-25 12:45:23 +01:00
Anatoli Papirovski
503900b463
async_hooks: ensure proper handling in runInAsyncScope
...
We should never try to manually run emitAfter in case of an error,
the exception handler will do it for us, if we're going to recover.
PR-URL: https://github.com/nodejs/node/pull/30965
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-16 21:59:50 -08:00
Anatoli Papirovski
2e738fb6b5
cluster: remove unnecessary bind
...
PR-URL: https://github.com/nodejs/node/pull/28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-14 09:01:52 -05:00
Anatoli Papirovski
af6c88c571
http2: remove unnecessary bind from setImmediate
...
PR-URL: https://github.com/nodejs/node/pull/28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-14 09:01:49 -05:00
Anatoli Papirovski
d00d81edd7
fs: remove unnecessary bind
...
Don't use Function.prototype.bind where it isn't
necessary. Rely on event emitter context instead
and on arrow function as class property.
PR-URL: https://github.com/nodejs/node/pull/28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-14 09:01:46 -05:00
Anatoli Papirovski
4547574386
perf_hooks: remove unnecessary bind
...
Pass through parameters using setImmediate rather
than using Function.prototype.bind to bind the
provided context.
PR-URL: https://github.com/nodejs/node/pull/28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-14 09:01:44 -05:00
Anatoli Papirovski
fea1f1cb9a
http: remove unnecessary bind
...
process.nextTick accepts additional parameters which
are passed through to the callback. Use that instead
of binding the function to a context.
PR-URL: https://github.com/nodejs/node/pull/28131
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-14 09:01:42 -05:00
Anatoli Papirovski
cde3928a10
process: improve queueMicrotask performance
...
Optimize the hot code paths of queueMicrotask by
not creating unnecessary objects, not looking up
properties on frozen primordials, etc.
PR-URL: https://github.com/nodejs/node/pull/28093
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2019-06-10 07:49:40 +02:00
Anatoli Papirovski
abf765e33c
process: code cleanup for nextTick
...
Fix a few edge cases and non-obvious issues with nextTick:
1. Emit destroy hook in a try-finally rather than triggering
it before the callback runs.
2. Re-word comment for processPromiseRejections and make sure
it returns true in the rejectionHandled case too.
3. Small readability improvements.
PR-URL: https://github.com/nodejs/node/pull/28047
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-09 06:52:39 +02:00
Anatoli Papirovski
58b1fe7bd1
http: fix socketOnWrap edge cases
...
Properly handle prependListener wrapping on http server
socket, in addition to on and addListener.
PR-URL: https://github.com/nodejs/node/pull/27968
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-02 10:17:50 +02:00
Anatoli Papirovski
f4f937b296
lib: remove Reflect.apply where appropriate
...
Using Reflect.apply where the callback context does not need
to change is unnecessary and less performant.
PR-URL: https://github.com/nodejs/node/pull/27349
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-04-30 08:36:55 +02:00
Anatoli Papirovski
29d0b43426
benchmark: fix http headers benchmark
...
PR-URL: https://github.com/nodejs/node/pull/27021
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-11 05:41:21 +02:00
Anatoli Papirovski
47f5cc1ad1
lib: faster FreeList
...
Make FreeList faster by using Reflect.apply and not using
is_reused_symbol, but rather just checking whether any
items are present in the list prior to calling alloc.
PR-URL: https://github.com/nodejs/node/pull/27021
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-11 05:40:59 +02:00
Anatoli Papirovski
2c49e8b537
lib: make queueMicrotask faster
...
No longer create an additional scope within queueMicrotask
in order to improve performance.
PR-URL: https://github.com/nodejs/node/pull/27032
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-05 05:37:11 +02:00
Anatoli Papirovski
d3d4e10107
async_hooks: improve AsyncResource performance
...
Accessing symbols is generally quite expensive and so is emitInit,
only do both when actually required.
PR-URL: https://github.com/nodejs/node/pull/27032
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-05 05:37:01 +02:00
Anatoli Papirovski
04355eff5b
async_hooks: minor cleanup and improvements
...
Cleanup some code and make the emit hooks very slightly faster.
PR-URL: https://github.com/nodejs/node/pull/27034
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-04 15:55:56 +02:00
Anatoli Papirovski
4306300b5e
timers: fix refresh inside callback
...
When `timers.refresh()` is called inside a callback, the timer would
incorrectly end up unrefed and thus not keep the event loop alive.
PR-URL: https://github.com/nodejs/node/pull/26721
Fixes: https://github.com/nodejs/node/issues/26642
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2019-03-20 07:21:58 +01:00
Anatoli Papirovski
d1d357d3ad
test: fix sequential/test-performance delay
...
PR-URL: https://github.com/nodejs/node/pull/25695
Fixes: https://github.com/nodejs/node/issues/23291
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2019-01-25 19:02:40 -08:00
Anatoli Papirovski
3ce9305a70
process: emit unhandled warning immediately
...
PR-URL: https://github.com/nodejs/node/pull/24632
Fixes: https://github.com/nodejs/node/issues/24209
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2018-11-27 22:19:35 -08:00
Anatoli Papirovski
9ca5c525f4
timers: fix priority queue removeAt
...
PR-URL: https://github.com/nodejs/node/pull/24322
Fixes: https://github.com/nodejs/node/issues/24320
Fixes: https://github.com/nodejs/node/issues/24362
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-11-14 20:38:00 -08:00
Anatoli Papirovski
958d5b7f1d
timers: fix priority queue removeAt fn
...
PR-URL: https://github.com/nodejs/node/pull/23870
Fixes: https://github.com/nodejs/node/issues/23860
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-10-25 10:44:18 -07:00
Anatoli Papirovski
e7af9830e9
timers: run nextTicks after each immediate and timer
...
In order to better match the browser behaviour, run nextTicks (and
subsequently the microtask queue) after each individual Timer and
Immediate, rather than after the whole list is processed. The
current behaviour is somewhat of a performance micro-optimization
and also partly dictated by how timer handles were implemented.
PR-URL: https://github.com/nodejs/node/pull/22842
Fixes: https://github.com/nodejs/node/issues/22257
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-17 20:38:07 -07:00
Anatoli Papirovski
e72c6af6c8
http2: do not falsely emit 'aborted' on push
...
A push stream should have its writable side closed upon receipt,
to avoid emitting the 'aborted' event when the readable side
is closed.
PR-URL: https://github.com/nodejs/node/pull/22878
Fixes: https://github.com/nodejs/node/issues/22851
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-09-22 15:36:59 +02:00
Anatoli Papirovski
16210cad09
fs: fix promisified fs.readdir withFileTypes
...
PR-URL: https://github.com/nodejs/node/pull/22832
Reviewed-By: Bryan English <bryan@bryanenglish.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-09-15 04:07:36 -07:00
Anatoli Papirovski
0aae34f52e
tls: remove SLAB_BUFFER_SIZE
...
This constant has not been in use for many years now and the test
alongside it is invalid, as well as flaky.
PR-URL: https://github.com/nodejs/node/pull/21199
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-08-12 10:22:10 -07:00
Anatoli Papirovski
01a160a05d
src: fix integer overflow in GetNow
...
PR-URL: https://github.com/nodejs/node/pull/22214
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Matheus Marchini <matheus@sthima.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-08-11 21:43:28 -07:00
Anatoli Papirovski
bfcf5b01bb
src: remove tick_info->has_thrown
...
This is no longer necessary in the only place it was used (timers).
PR-URL: https://github.com/nodejs/node/pull/20894
Fixes: https://github.com/nodejs/node/issues/10154
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-24 21:35:11 -07:00
Anatoli Papirovski
2930bd1317
src: refactor timers to remove TimerWrap
...
Refactor Timers to behave more similarly to Immediates by having
a single uv_timer_t handle which is stored on the Environment.
No longer expose timers in a public binding and instead make
it part of the internalBinding.
PR-URL: https://github.com/nodejs/node/pull/20894
Fixes: https://github.com/nodejs/node/issues/10154
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-24 21:35:05 -07:00
Anatoli Papirovski
6f63f8d730
test: remove outdated, non-functioning test
...
The timers directory test, utilizing FakeTime, has not worked in
quite a while and is not truly testing Node.js behaviour. If a
similar test is necessary it would be better suited to libuv
on which Node.js relies for timers functionality.
PR-URL: https://github.com/nodejs/node/pull/20894
Fixes: https://github.com/nodejs/node/issues/10154
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-06-24 21:34:59 -07:00
Anatoli Papirovski
7169181a0d
src: fix http2 typos
...
PR-URL: https://github.com/nodejs/node/pull/21194
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-06-11 09:36:00 -07:00
Anatoli Papirovski
083139d440
http2: safer Http2Session destructor
...
It's hypothetically (and with certain V8 flags) possible for the session
to be garbage collected before all the streams are. In that case, trying
to remove the stream from the session will lead to a segfault due to
attempting to access no longer valid memory. Fix this by unsetting the
session on any streams still around when destroying.
PR-URL: https://github.com/nodejs/node/pull/21194
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
2018-06-11 09:36:00 -07:00
Anatoli Papirovski
ff16545f60
test: check gc does not resurrect the loop
...
PR-URL: https://github.com/nodejs/node/pull/21093
Fixes: https://github.com/nodejs/node/issues/18190
Refs: https://github.com/nodejs/node/pull/18307
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-06-09 19:09:47 -07:00
Anatoli Papirovski
9788da962e
src: do not persist fs_poll handle in stat_watcher
...
Instead of relying on garbage collection to close the handle,
manage its state more explicitly.
PR-URL: https://github.com/nodejs/node/pull/21093
Fixes: https://github.com/nodejs/node/issues/18190
Refs: https://github.com/nodejs/node/pull/18307
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-06-09 19:09:46 -07:00
Anatoli Papirovski
d6bdfacf6c
src: do not persist timer handle in cares_wrap
...
Instead of relying on garbage collection to close the timer handle,
manage its state more explicitly.
PR-URL: https://github.com/nodejs/node/pull/21093
Fixes: https://github.com/nodejs/node/issues/18190
Refs: https://github.com/nodejs/node/pull/18307
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-06-09 19:09:29 -07:00
Anatoli Papirovski
af2a104563
child_process: swallow errors in internal communication
...
Much like with NODE_HANDLE_ACK, the internal protocol for communication
about the sent socket should not expose its errors to the users when
those async calls are not initiated by them.
PR-URL: https://github.com/nodejs/node/pull/21108
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2018-06-07 09:43:10 -04:00
Anatoli Papirovski
6858ab5d01
test: remove unref in http2 test
...
The bug referenced in this TODO was fixed and this test no longer
requires this code to pass.
PR-URL: https://github.com/nodejs/node/pull/21145
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-06-07 09:41:36 -04:00
Anatoli Papirovski
d0943bcb69
test: move benchmark-dgram to sequential
...
This test uses hardcoded ports, it should not be located in parallel.
PR-URL: https://github.com/nodejs/node/pull/21144
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-06-05 18:55:24 -07:00
0300f7c68c
src: store pointer to Environment on DestroyParam
...
To avoid a potential segfault when inside WeakCallback, store a
reference to Environment inside DestroyParam.
PR-URL: https://github.com/nodejs/node/pull/21099
Reviewed-By: Yang Guo <yangguo@chromium.org >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Co-authored-by: Yang Guo <yangguo@chromium.org >
Co-authored-by: Michaël Zasso <targos@protonmail.com >
2018-06-05 05:14:03 -04:00
Anatoli Papirovski
5a6b1975d5
timers: check can_call_into_js in Immediates
...
Prevent an infinite loop if it's not possible to call into JS.
PR-URL: https://github.com/nodejs/node/pull/21057
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-06-04 09:21:38 +02:00
Anatoli Papirovski
7b6c4283d2
http2: fix premature destroy
...
Check stream._writableState.finished instead of stream.writable
as the latter can lead to premature calls to destroy and dropped
writes on busy processes.
PR-URL: https://github.com/nodejs/node/pull/21051
Fixes: https://github.com/nodejs/node/issues/20750
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-06-03 16:24:31 +02:00
Anatoli Papirovski
d52878137d
test: unmark test-zlib.zlib-binding.deflate flaky
...
PR-URL: https://github.com/nodejs/node/pull/21109
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-06-03 15:33:29 +02:00
Anatoli Papirovski
35858bb98e
http2: force through RST_STREAM in destroy
...
If still needed, force through RST_STREAM in Http2Stream#destroy
calls, so that nghttp2 can wrap up properly and doesn't continue
trying to read & write data to the stream.
PR-URL: https://github.com/nodejs/node/pull/21016
Fixes: https://github.com/nodejs/node/issues/21008
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-06-01 10:58:26 +02:00
Anatoli Papirovski
87cd389bbf
http2: delay closing stream
...
Delay automatically closing the stream with setImmediate in order
to allow any pushStreams to be sent first.
PR-URL: https://github.com/nodejs/node/pull/20997
Fixes: https://github.com/nodejs/node/issues/20992
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-06-01 10:56:11 +02:00
Anatoli Papirovski
4b8ff3a424
test: fix flaky test-domain-timers
...
It's possible for this test to be extremely infrequently flaky if
1ms or more elapses between setting the two timeouts. In that case,
the second timer will not fire and the test will fail.
PR-URL: https://github.com/nodejs/node/pull/21019
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
2018-06-01 10:53:59 +02:00
Anatoli Papirovski
48a2568f41
timers: add hasRef method to Timeout & Immediate
...
Provide a way to check whether the current timer or immediate is refed.
PR-URL: https://github.com/nodejs/node/pull/20898
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-06-01 10:29:51 +02:00
Anatoli Papirovski
23a56e0c28
timers: use only a single TimerWrap instance
...
Hang all timer lists off a single TimerWrap and use the PriorityQueue
to manage expiration priorities. This makes the Timers code clearer,
consumes significantly less resources and improves performance.
PR-URL: https://github.com/nodejs/node/pull/20555
Fixes: https://github.com/nodejs/node/issues/16105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-22 23:26:12 +04:00
Anatoli Papirovski
6f6f7f749b
lib: add internal PriorityQueue class
...
An efficient JS implementation of a binary heap on top of an array with
worst-case O(log n) runtime for all operations, including arbitrary
item removal (unlike O(n) for most binary heap array implementations).
PR-URL: https://github.com/nodejs/node/pull/20555
Fixes: https://github.com/nodejs/node/issues/16105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-22 23:24:37 +04:00
Anatoli Papirovski
ef9d0ae6f2
test: fix flaky http2-session-unref
...
It's possible for the connections to take too long and since the server
is already unrefed, the process will just exit. Instead adjust the test
so that server unref only happens after all sessions have been
successfuly established and unrefed. That still tests the same condition
but will not fail under load.
PR-URL: https://github.com/nodejs/node/pull/20772
Fixes: https://github.com/nodejs/node/issues/20705
Fixes: https://github.com/nodejs/node/issues/20750
Fixes: https://github.com/nodejs/node/issues/20850
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-22 11:42:34 +04:00
Anatoli Papirovski
b11e19e8ee
http2: fix several serious bugs
...
Currently http2 does not properly submit GOAWAY frames when a session
is being destroyed. It also doesn't properly handle when the other
party severs the connection after sending a GOAWAY frame, even though
it should.
Edge, IE & Safari are currently unable to handle empty TRAILERS
frames despite them being correctly to spec. Instead send an empty
DATA frame with END_STREAM flag in those situations.
Fix and adjust several flaky and/or incorrect tests.
PR-URL: https://github.com/nodejs/node/pull/20772
Fixes: https://github.com/nodejs/node/issues/20705
Fixes: https://github.com/nodejs/node/issues/20750
Fixes: https://github.com/nodejs/node/issues/20850
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-22 11:42:33 +04:00
Anatoli Papirovski
8d38288a80
http2: fix end without read
...
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 >
2018-05-17 17:59:25 +04:00
Anatoli Papirovski
ac89450326
test: fix flaky http2-flow-control test
...
PR-URL: https://github.com/nodejs/node/pull/20556
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-05-08 14:14:34 -07:00
Anatoli Papirovski
34bd9f318a
benchmark: track exec time in next-tick-exec
...
The next-tick-exec benchmarks were meant to track nextTick execution
time but due to an error, they actually track addition and execution.
PR-URL: https://github.com/nodejs/node/pull/20462
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-06 07:29:47 +02:00
Anatoli Papirovski
491ae12e41
tls: cleanup onhandshakestart callback
...
Re-arrange and cleanup the flow of the onhandshakestart to be
more clear and less repetitive. Exit early in the case of a
first ever handshake for a given connection.
PR-URL: https://github.com/nodejs/node/pull/20466
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-06 07:28:26 +02:00
Anatoli Papirovski
9a3ae2fe9d
lib: expose FixedQueue internally and fix nextTick bug
...
A bug was introduced together with the FixedQueue implementation for
process.nextTick which meant that the queue wouldn't necessarily
fully clear on each run through. Fix it and abstract the data
structure into an internal module that can later be used elsewhere.
PR-URL: https://github.com/nodejs/node/pull/20468
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-05-06 07:21:32 +02:00
Anatoli Papirovski
b04d0921ae
util: improve spliceOne perf
...
Do less variable allocations and reassignments inside spliceOne
since it's relied on by some performance sensitive code.
PR-URL: https://github.com/nodejs/node/pull/20453
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-05-03 14:47:17 +02:00
Anatoli Papirovski
fe8794560a
events: optimize condition for optimal scenario
...
Instead of always checking whether we've already warned about a
possible EventEmitter memory leak, first run the rest of the
code as accessing random properties on an Array is expensive.
In addition, remove an unnecessary truthy check.
PR-URL: https://github.com/nodejs/node/pull/20452
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-05-03 14:45:09 +02:00
Anatoli Papirovski
a957f248ae
benchmark: fix next-tick-depth
...
A recent change made these benchmarks fail by always finishing
with 0 iterations. Restore a counter variable.
PR-URL: https://github.com/nodejs/node/pull/20461
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-05-03 07:14:40 +02:00
Anatoli Papirovski
198eb9c5d6
timers: reschedule interval even if it threw
...
To match browser behaviour, intervals should continue being
scheduled even if the user callback threw during execution.
PR-URL: https://github.com/nodejs/node/pull/20002
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-29 16:51:05 +02:00
Anatoli Papirovski
b55a11d1b1
http2: fix responses to long payload reqs
...
When a request with a long payload is received, http2 does
not allow a response that does not process all the incoming
payload. Add a conditional Http2Stream.close call that runs
only if the user hasn't attempted to read the stream.
PR-URL: https://github.com/nodejs/node/pull/20084
Fixes: https://github.com/nodejs/node/issues/20060
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-28 18:17:28 +02:00
Anatoli Papirovski
16aee380a5
util: fix isInsideNodeModules inside error
...
When isInsideNodeModules gets called while already processing
another stack trace, V8 will not call prepareStackTrace again.
This used to cause Node.js to just crash — fix it by checking
for expected return type of the stack (Array).
PR-URL: https://github.com/nodejs/node/pull/20266
Fixes: https://github.com/nodejs/node/issues/20258
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-04-28 08:20:51 +02:00
Anatoli Papirovski
602ffd6986
http: refactor outgoing headers processing
...
Use a shared function, for..in instead of Object.keys, do less work in
`setHeader` and instead defer some of it until later, and other minor
changes to improve clarity, as well as a slight boost in performance.
PR-URL: https://github.com/nodejs/node/pull/20250
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-27 20:31:25 +02:00
Anatoli Papirovski
54e112dd61
http: remove duplicate parser unset
...
freeParser already unsets parser property of socket if socket is passed
in specifically. There's no need to do this twice.
PR-URL: https://github.com/nodejs/node/pull/20126
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-23 15:59:28 +02:00
Anatoli Papirovski
58e0800b81
http: cleanup parser properties
...
Cleanup constructor and freeParser to manage all existing parser
properties, not just some.
PR-URL: https://github.com/nodejs/node/pull/20126
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-23 15:59:27 +02:00
Anatoli Papirovski
1c84914c5a
http: remove duplicate comment
...
A comment explaining kOnHeaders function of the parser was duplicated
in two places but the second instance was more confusing than helpful.
PR-URL: https://github.com/nodejs/node/pull/20126
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-23 15:59:26 +02:00
Anatoli Papirovski
2e31d5db73
http: cleanup _http_common.js
...
Remove constant deep property access by storing a reference,
use more const, make some conditionals stricter.
PR-URL: https://github.com/nodejs/node/pull/20126
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-23 15:59:26 +02:00
Anatoli Papirovski
647954d0a0
doc: fix incorrect net listen signature
...
PR-URL: https://github.com/nodejs/node/pull/20209
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-04-22 17:01:01 +02:00
Anatoli Papirovski
f48ca9c9c1
test: fix arg names in benchmark string_decoder
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:07:01 +02:00
Anatoli Papirovski
6af4f5ebb0
test: reduce duration in misc benchmark
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:57 +02:00
Anatoli Papirovski
e7913e450c
test: fix missing param in url benchmark
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:52 +02:00
Anatoli Papirovski
feba43c40e
test: use correct arg name in domains benchmark
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:48 +02:00
Anatoli Papirovski
967d80594c
test: use correct arg name in assert benchmark
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:44 +02:00
Anatoli Papirovski
71cc57e472
benchmark: do not multiply n by 1e6 in arrays
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:40 +02:00
Anatoli Papirovski
957532ec61
test: fix long-running http benchmarks
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:36 +02:00
Anatoli Papirovski
a2cf005cef
test: fix long-running buffer benchmarks
...
PR-URL: https://github.com/nodejs/node/pull/20125
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2018-04-22 11:06:30 +02:00
Anatoli Papirovski
e5f53206dd
http: simplify connection: close search
...
Remove upgrade from the regular expression as it is no longer used
and switch to using `.test()` instead of `.match()` as the value
matched is irrelevant.
PR-URL: https://github.com/nodejs/node/pull/20131
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-04-22 07:51:43 +02:00
Anatoli Papirovski
54caeae38a
http: use switch in matchHeader
...
Using a switch improves clarity of the code but also performance for
all but a few edge cases which remain on par with the old code.
PR-URL: https://github.com/nodejs/node/pull/20131
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-04-22 07:51:38 +02:00
Anatoli Papirovski
db0174bbc8
http: simplify isCookieField
...
Handrolling and checking char by char is no longer faster than just
using toLowerCase and strict comparison.
PR-URL: https://github.com/nodejs/node/pull/20131
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-04-22 07:51:32 +02:00
Anatoli Papirovski
d718d53996
buffer: fix deprecation warning emit
...
Due to npm using workers on Windows which inititate processes
for code within node_modules, the current way of testing is a
little too strict to catch all occurrences.
PR-URL: https://github.com/nodejs/node/pull/20163
Fixes: https://github.com/nodejs/node/issues/20160
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-04-20 17:21:10 +02:00
Anatoli Papirovski
700344e388
console: fix class inheritance regression
...
Due to a return statement with new inside the function, extending
Console class does not work when passing in just the stdout arg.
PR-URL: https://github.com/nodejs/node/pull/20158
Fixes: https://github.com/nodejs/node/issues/20157
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-04-20 12:05:54 +02:00
Anatoli Papirovski
3d480dcf4c
http: fix _dump regression
...
A recent set of changes removed _consuming tracking from server
incoming messages which ensures that _dump only runs if the
user has never attempted to read the incoming data. Fix by
reintroducing _consuming which tracks whether _read was ever
successfully called.
PR-URL: https://github.com/nodejs/node/pull/20088
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-04-19 08:41:17 +02:00
Anatoli Papirovski
95fafc0254
http: fix undefined error in parser event
...
The current check for socket.server[kIncomingMessage] does not
account for the possibility of a socket.server that doesn't
have that property defined. Fix it.
PR-URL: https://github.com/nodejs/node/pull/20029
Fixes: https://github.com/nodejs/node/issues/19231
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Khaidi Chu <i@2333.moe >
2018-04-17 16:08:31 +02:00
Anatoli Papirovski
4f2000f9fe
timers: call destroy on interval error
...
When an interval callback throws an error, the destroy
hook is never called due to a faulty if condition.
PR-URL: https://github.com/nodejs/node/pull/20001
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-04-17 16:05:11 +02:00
Anatoli Papirovski
734eb17e5d
timers: fix subsequent enroll calls not working
...
A bug was introduced in #17704 which meant that subsequent
calls to enroll would unset the new _idleTimeout and the
enrolled object could never again function as a timer.
PR-URL: https://github.com/nodejs/node/pull/19936
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-04-17 16:01:39 +02:00
Anatoli Papirovski
15e136d9c5
test: fix http-agent-destroyed-socket cb not firing
...
A whole part of the test-http-agent-destroyed-socket test
was not running as the semantics of http events changed
slightly and were no longer triggering the expected event.
Instead listen to the same event on the socket to verify
that the code being tested is still working as expected.
PR-URL: https://github.com/nodejs/node/pull/20006
Fixes: https://github.com/nodejs/node/issues/8613
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-04-17 14:20:20 +02:00
Anatoli Papirovski
f7fbbeedc6
http: relax requirements on upgrade listener
...
The http spec does not say anything about Upgrade headers making
protocol switch mandatory but Node.js implements them as if they
are. Relax the requirements to only destroy the socket if no
upgrade listener exists on the client when status code is 101.
PR-URL: https://github.com/nodejs/node/pull/19981
Fixes: https://github.com/nodejs/node/issues/11552
Refs: https://tools.ietf.org/html/rfc7230#section-6.7
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-04-16 11:02:23 +02:00
Anatoli Papirovski
4082bdf199
doc: remove _writableState reference
...
PR-URL: https://github.com/nodejs/node/pull/20004
Fixes: https://github.com/nodejs/node/issues/6799
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-13 20:52:49 +02:00
Anatoli Papirovski
4d074343dd
async_hooks,process: remove internalNextTick
...
Instead of having mostly duplicate code in form of internalNextTick,
instead use the existing defaultAsyncTriggerIdScope with a slight
modification which allows undefined triggerAsyncId to be passed in,
which then just triggers the callback with the provided arguments.
PR-URL: https://github.com/nodejs/node/pull/19147
Refs: https://github.com/nodejs/node/issues/19104
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Andreas Madsen <amwebdk@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-08 13:23:44 +01:00
Anatoli Papirovski
28f3ffba0f
timers: add helper fn for async init
...
There are currently 3 places in Timers where the exact same code
appears. Instead create a helper function that does the same job
of setting asyncId & triggerAsyncId, as well as calling emitInit.
PR-URL: https://github.com/nodejs/node/pull/18825
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-02-19 07:02:21 -05:00
Anatoli Papirovski
94e8d2a5ff
test: fix unrelated variable name changes
...
PR-URL: https://github.com/nodejs/node/pull/18823
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-02-16 22:02:22 +01:00
Anatoli Papirovski
e9ac80bb39
async_hooks: clean up usage in internal code
...
Instead of exposing internals of async_hooks & async_wrap throughout
the code base, create necessary helper methods within the internal
async_hooks that allows easy usage by Node.js internals. This stops
every single internal user of async_hooks from importing a ton of
functions, constants and internal Aliased Buffers from C++ async_wrap.
Adds functions initHooksExist, afterHooksExist, and destroyHooksExist
to determine whether the related emit methods need to be triggered.
Adds clearDefaultTriggerAsyncId and clearAsyncIdStack on the JS side
as an alternative to always calling C++.
Moves async_id_symbol and trigger_async_id_symbol to internal
async_hooks as they are never used in C++.
Renames newUid to newAsyncId for added clarity of its purpose.
Adjusts usage throughout the codebase, as well as in a couple of tests.
PR-URL: https://github.com/nodejs/node/pull/18720
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-02-16 14:23:14 -05:00
Anatoli Papirovski
e782715d0a
string_decoder: fix regressions
...
There are libraries which invoke StringDecoder using .call and
.inherits, which directly conflicts with making StringDecoder
be a class which can only be invoked with the new keyword.
Revert to declaring it as a function.
StringDecoder#lastNeed was not defined, redefine it using
the new interface and fix StringDecoder#lastTotal.
PR-URL: https://github.com/nodejs/node/pull/18723
Refs: https://github.com/nodejs/node/pull/18537
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-02-13 08:03:23 -05:00
Anatoli Papirovski
a27e443df3
test: fix missing param in benchmark-timers
...
PR-URL: https://github.com/nodejs/node/pull/18734
Fixes: https://github.com/nodejs/node/issues/18730
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-02-12 16:30:33 +01:00
Anatoli Papirovski
2aa3e3b00f
timers: fix enroll deprecation wording
...
PR-URL: https://github.com/nodejs/node/pull/18704
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-02-11 10:34:13 -05:00
Anatoli Papirovski
0f9efef05d
timers: refactor timer list processing
...
Instead of using kOnTimeout index to track a special list
processing function, just pass in a function to C++ at
startup that executes all handles and determines which
function to call.
This change improves the performance of unpooled timeouts
by roughly 20%, as well as makes the unref/ref processing
easier to follow.
PR-URL: https://github.com/nodejs/node/pull/18582
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
2018-02-09 14:59:07 -05:00
Anatoli Papirovski
dbd1d1d43f
doc: fix arg definition in fs
...
Currently doc building doesn't support ES-style default params in
function definitions which causes an error.
PR-URL: https://github.com/nodejs/node/pull/18678
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-02-09 11:28:16 -05:00
Anatoli Papirovski
6963a93d0e
test: fix flaky timers-block-eventloop test
...
Due to extensive reliance on timings and the fs module, this test
is currently inherently flaky. Refactor it to simply use setImmediate
and only one busy loop.
PR-URL: https://github.com/nodejs/node/pull/18567
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-02-08 15:33:02 -05:00
Anatoli Papirovski
8204b0f9c6
timers: simplify clearTimeout & clearInterval
...
Remove unnecessary condition from timeout & interval clearing.
PR-URL: https://github.com/nodejs/node/pull/18579
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-02-08 09:01:54 -05:00
Anatoli Papirovski
c11cb038a1
timers: async track unref timers
...
When async hooks integration for Timers was introduced, it was
not included in the code for unref'd or subsequently ref'd
timers which means those timers only have Timerwrap hooks.
PR-URL: https://github.com/nodejs/node/pull/18579
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-02-08 09:01:54 -05:00