summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-02-09src: remove unused method in env.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25934 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-02-08src: pass along errors from StreamBase req obj creationsAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25822 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-02-08src: pass along errors from fs object creationsAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25822 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-02-08src: pass along errors from http2 object creationAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25822 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-02-08src: pass along errors from tls object creationAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25822 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-02-08perf_hooks: implement histogram based apiJames M Snell
Add a sampling-based event loop delay monitor. ```js const { monitorEventLoopDelay } = require('perf_hooks'); const h = monitorEventLoopDelay(); h.enable(); h.disable(); console.log(h.percentiles); console.log(h.min); console.log(h.max); console.log(h.mean); console.log(h.stddev); console.log(h.percentile(50)); ``` PR-URL: https://github.com/nodejs/node/pull/25378 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-08report: use uv_getnameinfo() for socket endpointscjihrig
PR-URL: https://github.com/nodejs/node/pull/25962 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-08report: widen scope of #ifndefcjihrig
This commit moves a #ifndef _WIN32 to contain the entire if statement that inspects file descriptors. Prior to this commit, the #ifndef was inside the if, making it essentially dead code on Windows. PR-URL: https://github.com/nodejs/node/pull/25960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-08report: remove unnecessary case block scopescjihrig
PR-URL: https://github.com/nodejs/node/pull/25960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-08report: remove empty string stream insertioncjihrig
PR-URL: https://github.com/nodejs/node/pull/25960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-08src: nullcheck on trace controllerGireesh Punathil
Insert a NULLCHECK prior to return. Ideally we do this in the caller, but the TraceController object is somewhat special as: 1. It is accessed by most threads 2. It's life cycle is managed by Agent::Agent 3. It's getter is invoked through Base Methods (upstream) Refs: https://github.com/nodejs/node/issues/25814 PR-URL: https://github.com/nodejs/node/pull/25943 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Masashi Hirano <shisama07@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-08src: allow --perf-prof-unwinding-info in NODE_OPTIONSTom Gallacher
PR-URL: https://github.com/nodejs/node/pull/25565 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-08src: allow --perf-basic-prof-only-functions in NODE_OPTIONSTom Gallacher
PR-URL: https://github.com/nodejs/node/pull/25565 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-08src: make watchdog async callback a lambdaGireesh Punathil
`Watchdog::Async` features only once for the async callback, so make it a lambda. PR-URL: https://github.com/nodejs/node/pull/25945 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-08src: make deleted function public in agent.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25909 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-02-08lib: use `internal/options` to query `--abort-on-uncaught-exception`Joyee Cheung
Instead of using `internalBinding('config').shouldAbortOnUncaughtException`. Also removes that property from the binding. PR-URL: https://github.com/nodejs/node/pull/25862 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-07src: use bool instead of integer literal in connection_wrap.ccgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25923 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-07src: refactor to nullptr in cpp codegengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25888 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-02-07src: clean unused code in agent.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25914 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-07src: use NULL check macros to check nullptrZYSzys
PR-URL: https://github.com/nodejs/node/pull/25916 Refs: https://github.com/nodejs/node/pull/20914 Reviewed-By: Masashi Hirano <shisama07@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-07src: fix compiler warnings in node_buffer.ccDaniel Bevenius
Currently the following compiler warnings are generated on Linux: ../src/node_buffer.cc: In function 'void node::Buffer::{anonymous}::StringSlice( const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = (node::encoding)1]': ../src/node_buffer.cc:54:20: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized] if (end < start) end = start; ^~~ ../src/node_buffer.cc:50:10: note: 'start' was declared here size_t start; ^~~~~ This commit initializes start and end to zero to avoid these warnings. PR-URL: https://github.com/nodejs/node/pull/25665 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06perf_hooks: only enable GC tracking when it's requestedJoyee Cheung
Previously a GC prologue callback and a GC epilogue callback are always unconditionally enabled during bootstrap when the `performance` binding is loaded, even when the user does not use the performance timeline API to enable GC tracking. This patch makes the callback addition conditional and only enables them when the user explicitly requests `observer.observe(['gc'])` to avoid the overhead. PR-URL: https://github.com/nodejs/node/pull/25853 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06report: include information about event loop itselfAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25906 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06src: remove redundant method in node_worker.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25849 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06src: delete unreachable code in node_perf.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25850 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06src: move process.reallyExit impl into node_process_methods.ccJoyee Cheung
Because the part that is shared by `process.reallyExit` and the Node.js teardown is `WaitForInspectorDisconnect()`, move that into node_internals.h instead, and move the C++ binding code into `node_process_methods.cc` since that's the only place it's needed. PR-URL: https://github.com/nodejs/node/pull/25860 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-02-06src: fix data type in node_crypto.ccgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25889 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05tls: in-line comments and other cleanupsSam Roberts
PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05src: const_cast is necessary for 1.1.1, not 0.9.7Sam Roberts
The const_cast used to be necessary for SSL_get_app_data() in OpenSSL 0.9.7, but node doesn't compile against OpenSSL versions that old. However, now it's needed for the recently introduced SSL_renegotiate_pending(), which is not const-correct as of 1.1.1a. PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05src: refactor SSLError case statementSam Roberts
- Don't use both break and return simultaneously. - Use case:/UNREACHABLE() to enforce that all cases are handled, instead of CHECK(). PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05src: organize TLSWrap declarations by parentSam Roberts
Make it clear which of the multiple interfaces a TLSWrap method is implementing by grouping and commenting the related methods. PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05src: remove unused TLWrap::EnableTrace()Sam Roberts
Declaration is unused, it was added by mistake in 46c5c3388d2. PR-URL: https://github.com/nodejs/node/pull/25861 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05worker: add mutex lock to MessagePort ctorAnna Henningsen
Automated tooling for race condition detection reports this as a possible problem. It’s unlikely that something bad would happen here (beyond maybe calling `TriggerAsync()` twice), but adding this should be okay. PR-URL: https://github.com/nodejs/node/pull/25911 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05src: split ownsProcessState off isMainThreadAnna Henningsen
Embedders may want to control whether a Node.js instance controls the current process, similar to what we currently have with `Worker`s. Previously, the `isMainThread` flag had a bit of a double usage, both for indicating whether we are (not) running a Worker and whether we can modify per-process state. PR-URL: https://github.com/nodejs/node/pull/25881 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05src: add PrintLibuvHandleInformation debug helperAnna Henningsen
This function is not only helpful for debugging crashes, but can also be used as an ad-hoc debugging statement. PR-URL: https://github.com/nodejs/node/pull/25905 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05report: print libuv handle addresses as hexcjihrig
PR-URL: https://github.com/nodejs/node/pull/25910 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05worker,etw: only enable ETW on the main threadAnna Henningsen
The Windows ETW code is not written to be compatible with multi threading, and in particular it relies on global state like a single static `uv_async_t`. Adding that to multiple threads would corrupt the corresponding loops' handle queues. This addresses the flakiness of at least `test-worker-exit-code` and very likely other flaky tests that relate to Worker threads on Windows as well. Fixes: https://github.com/nodejs/node/issues/25847 Fixes: https://github.com/nodejs/node/issues/25702 Fixes: https://github.com/nodejs/node/issues/24005 Fixes: https://github.com/nodejs/node/issues/23873 PR-URL: https://github.com/nodejs/node/pull/25907 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05report: use libuv calls for OS and machine infocjihrig
PR-URL: https://github.com/nodejs/node/pull/25900 Fixes: https://github.com/nodejs/node/issues/25843 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-02-05crypto: don't crash X509ToObject on errorDavid Benjamin
Use MaybeLocal::ToLocal and don't crash X509ToObject on error. PR-URL: https://github.com/nodejs/node/pull/25717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05crypto: fix malloc mixing in X509ToObjectDavid Benjamin
EC_KEY_key2buf returns an OPENSSL_malloc'd pointer so it shouldn't be passed into Buffer::New, which expect a libc malloc'd pointer. Instead, factor out the ECDH::GetPublicKey code which uses EC_POINT_point2oct. This preserves the existing behavior where encoding failures are silently ignored, but it is probably safe to CHECK fail them instead. PR-URL: https://github.com/nodejs/node/pull/25717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-02-05src: use `visibility("default")` exports on POSIXJeremy Apthorp
Electron uses this because Chromium builds with symbols hidden by default. Refs:https://github.com/electron/node/commit/ 88b494191c2a5b50b01dab80cd61ba3c0e0fbeb9 Refs: https://github.com/electron/node/commit/ 1293d1d7d0c33d3925da11ceccdce4eb2e927a43 PR-URL: https://github.com/nodejs/node/pull/25893 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
2019-02-04src: fix race condition in `~NodeTraceBuffer`Anna Henningsen
Libuv does not guarantee that handles have their close callbacks called in the order in which they were added (and in fact, currently calls them in reverse order). This patch ensures that the `flush_signal_` handle is no longer in use (i.e. its close callback has already been run) when we signal to the main thread that `~NodeTraceBuffer` may be destroyed. The same applies for `~NodeTraceWriter`. Credit for debugging goes to Gireesh Punathil. Fixes: https://github.com/nodejs/node/issues/25512 Co-authored-by: Gireesh Punathil <gpunathi@in.ibm.com> PR-URL: https://github.com/nodejs/node/pull/25896 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
2019-02-04src: remove unimplemented method in node_http2.hgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25732 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-04src: use nullptr in node_buffer.ccgengjiawen
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: https://github.com/nodejs/node/pull/25820 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-03src: remove main_isolateAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25823 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-03src,lib: remove dead `process.binding()` codeAnna Henningsen
There are no non-internal builtin modules left, so this should be safe to remove to a large degree. PR-URL: https://github.com/nodejs/node/pull/25829 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-03inspector,vm: remove --eval wrapperAnna Henningsen
Report the actual source code when running with `--eval` and `--inspect-brk`, by telling the vm module to break on the first line of the script being executed rather than wrapping the source code in a function. PR-URL: https://github.com/nodejs/node/pull/25832 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-02-03src: handle errors while printing error objectsAnna Henningsen
Handle situations where accessing `.name` or `.stack` on an object fails. Fixes: https://github.com/nodejs/node/issues/25718 PR-URL: https://github.com/nodejs/node/pull/25834 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-02-03src: use struct as arguments to node::AssertAnna Henningsen
This just makes the code a bit more obvious (subjectively). PR-URL: https://github.com/nodejs/node/pull/25869 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-02-01tls: introduce client 'session' eventSam Roberts
OpenSSL has supported async notification of sessions and tickets since 1.1.0 using SSL_CTX_sess_set_new_cb(), for all versions of TLS. Using the async API is optional for TLS1.2 and below, but for TLS1.3 it will be mandatory. Future-proof applications should start to use async notification immediately. In the future, for TLS1.3, applications that don't use the async API will silently, but gracefully, fail to resume sessions and instead do a full handshake. See: https://wiki.openssl.org/index.php/TLS1.3#Sessions PR-URL: https://github.com/nodejs/node/pull/25831 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>