profile
viewpoint

nodejs/nan 2825

Native Abstractions for Node.js

trevnorris/cbuffer 174

JavaScript Circular Buffer

nodejs/benchmarking 153

Node.js Benchmarking Working Group

indutny/caine 141

Friendly butler

trevnorris/buffer-dispose 46

Incredibly unsafe way to free a Buffer

indutny/hash-cracker 20

V8 Hash Seed timing attack

trevnorris/fuq.h 17

A Fundamentally Unstable Queue in C

nodesource/event-loop-demo 11

Example server demonstrating effect of processing load and response times

indutny/talks 8

Slides from talks

trevnorris/defactor 7

A Deferred Factory Object

push eventtrevnorris/.vim

Trevor Norris

commit sha 163b75eb774b8903e8d2722aa70ba9c5463c4ac6

Misc changes

view details

push time in 4 days

push eventtrevnorris/node-ofe

Trevor Norris

commit sha cdd7a7c7ba7ffb1df083776d8b9cd528baf98370

Update readme

view details

push time in 10 days

issue closedtrevnorris/node-ofe

wish: document example heap dump.

An example of the heap dump output would be helpful, to see the formatting and content in included.

closed time in 10 days

markstos

issue closedtrevnorris/node-ofe

ofe install fails on Windows 8.1

When I try to install ofe, this message is shown:

LINK : fatal error LNK1194: cannot delay-load 'node.exe' due to import of data symbol '"__declspec(dllimport) const v8::OutputStream::`vftable'" (__imp_??_7OutputStream@v8@@6B@)'; link without /DELAYLOAD:node.exe [D:\and-dev\testtool-server\testtoolserver\server\node_modules\ofe\build\ofe.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Diego\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Diego\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\and-dev\testtool-server\testtoolserver\server\node_modules\ofe
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Diego\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ofe"
npm ERR! node v6.2.0
npm ERR! npm  v2.15.6
npm ERR! code ELIFECYCLE

closed time in 10 days

diegosantosrd

issue commenttrevnorris/node-ofe

ofe install fails on Windows 8.1

Will take another look if someone else reports this issue.

diegosantosrd

comment created time in 10 days

issue closedtrevnorris/node-ofe

Won't install against node v14.1

% npm install ofe

> ofe@0.5.1 install /Users/jorisw/Projects/xxx/xxx/node_modules/ofe
> node-gyp rebuild

  CXX(target) Release/obj.target/ofe/ofe.o
In file included from ../ofe.cc:1:
In file included from ../../nan/nan.h:2884:
../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908.
      [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8.h:5202:3: note: 'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
../ofe.cc:70:7: error: no type named 'SetFatalErrorHandler' in 'v8::V8'
  V8::SetFatalErrorHandler(OnFatalError);
  ~~~~^
../ofe.cc:74:11: error: no template named 'Handle'
void Init(Handle<Object> target) {
          ^
../ofe.cc:75:7: error: no type named 'SetFatalErrorHandler' in 'v8::V8'
  V8::SetFatalErrorHandler(OnFatalError);
  ~~~~^
../ofe.cc:77:55: error: too few arguments to function call, single argument 'context' was not specified
      Nan::New<FunctionTemplate>(Method)->GetFunction());
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8.h:6404:3: note: 'GetFunction' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
  ^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8config.h:422:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
1 warning and 4 errors generated.
make: *** [Release/obj.target/ofe/ofe.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jorisw/Projects/xxx/xxx/node_modules/ofe
gyp ERR! node -v v14.1.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN zenbot4@4.1.0 No license field.

macOS Catalina.

closed time in 10 days

jorisw

issue commenttrevnorris/node-ofe

Won't install against node v14.1

Didn't realize people still use this. I updated it to work on v10.x+ and published it as version 0.6.0 to github.

jorisw

comment created time in 10 days

created tagtrevnorris/node-ofe

tag0.6.0

Overwrite OnFatalError to create a heapdump

created time in 10 days

push eventtrevnorris/node-ofe

Trevor Norris

commit sha c3593ceb204adb8c9ba2f3513fcc7021087622db

Add support for node v10.x+ Some people still use this, so updated it for v10.x through v14.x usage.

view details

Trevor Norris

commit sha ae2c3645b8b586daeb2c883d578434a113ad22ce

Release 0.6.0

view details

push time in 10 days

issue closedjstat/jstat

how to get mannWhitneyUTest?

closed time in 10 days

CigoZim

issue commentjstat/jstat

how to get mannWhitneyUTest?

It'll need to be contributed by the community. I don't have a background in stats, and am only here to maintain the code side of things.

Will be happy to review a PR with the given code and tests. :)

CigoZim

comment created time in 10 days

pull request commentjstat/jstat

Avoid using arguments.callee

Also tagged and published this in version 1.9.4.

mtszpater

comment created time in 10 days

created tagjstat/jstat

tag1.9.4

JavaScript Statistical Library

created time in 10 days

push eventjstat/jstat

Trevor Norris

commit sha 65ce096a99f753d6a22482e5e74accbfc1c33767

Release 1.9.4 * c528b29 Avoid using arguments.callee * 9157d28 Fix docs error * cf481d7 Fix API reference error

view details

push time in 10 days

push eventjstat/jstat

push time in 10 days

push eventjstat/jstat

Trevor Norris

commit sha 045052c96f5bc857e020244443b92516e954085e

Add license file

view details

push time in 10 days

push eventjstat/jstat

Mateusz Pater

commit sha c528b295a0b00994ce6e803e2456644a0304d832

Avoid using arguments.callee PR-URL: https://github.com/jstat/jstat/pull/263 Reviewed-by: Trevor Norris <trev.norris@gmail.com>

view details

push time in 10 days

PR closed jstat/jstat

Avoid using arguments.callee

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee

: The 5th edition of ECMAScript (ES5) forbids use of arguments.callee() in strict mode. Avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself.

Angular 10 forces strict mode so when you want to use this library you receive:

ERROR TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at Function.jStat.<computed> [as lognormal] (jstat.js:1724)
    at _init.jStat.fn.<computed> [as lognormal] (jstat.js:1733)
[..]

This pull request fixes it.

+7 -7

1 comment

3 changed files

mtszpater

pr closed time in 10 days

pull request commentjstat/jstat

Avoid using arguments.callee

Thanks. Landed in b39591e7d7.

mtszpater

comment created time in 10 days

push eventjstat/jstat

Mateusz Pater

commit sha b39591e7d74592cf1f274a1a58da331066fabe2d

Avoid using arguments.callee PR-URL: https://github.com/jstat/jstat/pull/263 Reviewed-by: Trevor Norris <trev.norris@gmail.com>

view details

push time in 10 days

pull request commenttrevnorris/cbuffer

Added TypeScript definitions

@russaa Landed this and published v2.2.0. Also published this in npm on cbuffer so it's all lower case.

russaa

comment created time in 10 days

push eventtrevnorris/cbuffer

Trevor Norris

commit sha 967d85b03d3b3bca6182287b818fd764c03b8761

Add pop tests

view details

russaa

commit sha 73ae86d26446e4ec19ce7a494631bd9049edbb33

Added TypeScript definitions PR-URL: https://github.com/trevnorris/cbuffer/pull/28 Reviewed-by: Trevor Norris <trev.norris@gmail.com>

view details

push time in 10 days

push eventtrevnorris/cbuffer

russaa

commit sha ce3bd3ad49478fa4ca27e29516ce1fd5d058577a

Added TypeScript definitions PR-URL: https://github.com/trevnorris/cbuffer/pull/28 Reviewed-by: Trevor Norris <trev.norris@gmail.com>

view details

push time in 10 days

PR merged trevnorris/cbuffer

Added TypeScript definitions

TypeScript definitions for CBuffer

usage in TypeScript projects:

  • import using CommonJS-style:
    import CBuffer = require('CBuffer');
    
  • or when building with --allowSyntheticDefaultImports or --esModuleInterop
    import CBuffer from 'CBuffer';
    
+118 -0

1 comment

2 changed files

russaa

pr closed time in 10 days

issue commentnodejs/node

[discuss] event loop idle metrics

Probably. :)

jasnell

comment created time in 10 days

PullRequestReviewEvent

pull request commentnodejs/node

perf_hooks: add idleTime and event loop util

Will this be backported to v14.x or v12.x?

trevnorris

comment created time in a month

delete branch trevnorris/node

delete branch : idle-time

delete time in a month

push eventtrevnorris/node

Trevor Norris

commit sha 47b1caffaf2467ddc29deb07b25ee9cf983bb99d

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This has been added to prevent accidental miscalculations of the event loop utilization. Such as not taking into consideration offsetting nodeTiming.loopStart or timing differences when being called from a Worker thread.

view details

push time in a month

push eventtrevnorris/node

Trevor Norris

commit sha cab2780e12689a91f0be220164d6d5e0644e6900

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This has been added to prevent accidental miscalculations of the event loop utilization. Such as not taking into consideration offsetting nodeTiming.loopStart or timing differences when being called from a Worker thread.

view details

push time in a month

pull request commentnodejs/node

perf_hooks: add idleTime and event loop util

@Flarna @gireeshpunathil @Qard @mcollina @juanarbol @edsadr @jasnell Thank you everyone for the prompt reviews. I request another approval because I made an alteration to the API. Here are the specific changes from the last push:

  • eventLoopUtilization() now operates more like process.hrtime(). As in it will return the difference, instead of the totals, between the current call and the previous call. It also allows passing a second object that will perform the calculations for the user.
  • Documentation has been updated, along with an explanation of event loop utilization and an example of how it differs from CPU utilization.
  • More tests have been added. Specifically around how the calculations are performed (in case any of the nodeTiming implementation specifics are changed in the future) and whether it works correctly within Worker threads.
trevnorris

comment created time in a month

push eventtrevnorris/node

Trevor Norris

commit sha beb65567c425d11904c494bbccd01bd4ba1d1fed

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This has been added to prevent accidental miscalculations of the event loop utilization. Such as not taking into consideration offsetting nodeTiming.loopStart or timing differences when being called from a Worker thread.

view details

push time in a month

push eventtrevnorris/node

Trevor Norris

commit sha fc933fa2b630e509e6bccf89dc704b875e68e0cd

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This has been added to prevent accidental miscalculations of the event loop utilization. Such as not taking into consideration offsetting nodeTiming.loopStart or timing differences when being called from a Worker thread.

view details

push time in a month

Pull request review commentnodejs/node

perf_hooks: add idleTime and event loop util

 obs.observe({ entryTypes: ['function'] }); wrapped(); ``` +### `performance.eventLoopUtilization([util])`+<!-- YAML+added:+-->++* `util` {Object} The result of a previous call to `eventLoopUtilization()`+* Returns {Object}+  * `idle` {number}+  * `active` {number}+  * `utilization` {number}++The `eventLoopUtilization()` method returns an object that contains the+cumulative duration of time the event loop has been both idle and active as a+high resolution milliseconds timer. The event loop utilization as a percentage+is calculated in the `utilization` value.++`util` is an optional parameter that must be the result of a previous+`eventLoopUtilization()` call. The `utilization` value is a calculation of the+diff from the time when the previous call was made. Not from the total+cumulative values.++Passing in a user-defined object instead of the result of a previous call to+`eventLoopUtilization()` will lead to undefined behavior.

I copied this from the process.hrtim() docs, but you're right. Better explanation would be good.

trevnorris

comment created time in a month

PullRequestReviewEvent

pull request commentnodejs/node

perf_hooks: add idleTime and event loop util

The failed test didn't take into consideration the timing difference if the test was executed from a Worker thread. Will fix that now.

trevnorris

comment created time in a month

pull request commentnodejs/node

perf_hooks: add idleTime and event loop util

Force pushed a change to remove the timeout epsilon test. The other tests rely on the accumulators and shouldn't be prone to the same timing issues.

trevnorris

comment created time in a month

push eventtrevnorris/node

Trevor Norris

commit sha 95733246b286ac582051b5a6e0933bd0282029f1

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

view details

push time in a month

pull request commentnodejs/node

perf_hooks: add idleTime and event loop util

Curse these timing tests. It's so hard not to make them flaky. I'll work on it.

trevnorris

comment created time in a month

push eventtrevnorris/node

Trevor Norris

commit sha e7a47d1731d45c21271e2a1531247881cd981fe1

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

view details

push time in a month

issue commentnodejs/node

[discuss] event loop idle metrics

PR created: https://github.com/nodejs/node/pull/34938

jasnell

comment created time in a month

push eventtrevnorris/node

Trevor Norris

commit sha 3c2ff816d438dcf555d32c5738224cc32d9b23b4

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

view details

push time in a month

PR opened nodejs/node

perf_hooks: add idleTime and event loop util

Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized.

Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] documentation is changed or added
  • [x] commit message follows commit guidelines
+166 -1

0 comment

8 changed files

pr created time in a month

push eventtrevnorris/node

Trevor Norris

commit sha 35e4e2fc7342cb30cb0dafc110fe9baacb37c029

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

view details

push time in a month

create barnchtrevnorris/node

branch : idle-time

created branch time in a month

push eventtrevnorris/node

gengjiawen

commit sha c6b96895cc74bc6bd658b4c6d5ea152d6e686d20

meta: enable wasi for CODEOWNERS PR-URL: https://github.com/nodejs/node/pull/34889 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>

view details

ExE Boss

commit sha 565d9939684c21ea9d121eb77ced43592b73e7c3

errors: use `ErrorPrototypeToString` from `primordials` object PR-URL: https://github.com/nodejs/node/pull/34891 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Rich Trott

commit sha a7572d1422488231c65f1195bb6f97367e03da74

doc: fix broken markdown/display in cli.html The `<` character is interpreted as the start of an HTML tag, making the word `address` not render and the rest of the document rendered with a grey background and in italics. Use `&lt;` instead. PR-URL: https://github.com/nodejs/node/pull/34892 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

Rich Trott

commit sha 8134c6468c1043be0b866cd9521006a83eedfa3d

doc: improve link-local text in dgram.md Minor improvements. PR-URL: https://github.com/nodejs/node/pull/34868 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

Rich Trott

commit sha 4332f738326d9a067d859ef86e78fadeb95f1b2c

tools,doc: remove "toc" anchor name The _name_ attribute is obsolete. Changing it to _id_ in the case of "toc" would result in a conflict with an existing id. However, there are no links to "#toc" in our docs. And if there were, it would be more appropriate to link to the id toc which is the toc for the individual documents. So remove the anchor name entirely. PR-URL: https://github.com/nodejs/node/pull/34893 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

Richard Lau

commit sha cc39bdf72442aa7800d20c9a832b3aa0a069acdf

module: drop `-u` alias for `--conditions` Old versions of mocha break after https://github.com/nodejs/node/pull/34637. This was a bug in mocha, but since this is a widely used module we can expect ecosystem breakage until modules are updated to the latest version of mocha. Drop the conflicting `-u` alias -- we can potentially bring it back once modules have been updated. PR-URL: https://github.com/nodejs/node/pull/34935 Refs: https://github.com/mochajs/mocha/issues/4417 Refs: https://github.com/nodejs/node/pull/34637 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>

view details

Turner Jabbour

commit sha 9ded2942a40da0badc9e91b3658fc6a97abcb3a4

src,doc: rephrase for clarity PR-URL: https://github.com/nodejs/node/pull/34879 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>

view details

Turner Jabbour

commit sha 0f9650bcddc79edb2d6ed447bc0416236239c0a0

src,doc: fix grammar due to missing 'is' PR-URL: https://github.com/nodejs/node/pull/34897 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>

view details

Turner Jabbour

commit sha 87c43dee5302126fa370f5407a963cc8ab8ae013

src,doc: fix wording to refer to context, not environment PR-URL: https://github.com/nodejs/node/pull/34880 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>

view details

Trevor Norris

commit sha 234f00c253444dacde8ba375164f3d14dbd65591

perf_hooks: add idleTime and event loop util Use uv_metrics_idle_time() to return a high resolution millisecond timer of the amount of time the event loop has been idle since it was initialized. Include performance.eventLoopUtilization() API to handle the math of calculating the idle and active times. This is added to prevent accidental calculation errors by users that forget about accounting for timing differences. Such as taking into consideration nodeTiming.loopStart.

view details

push time in a month

issue commentnodejs/node

[discuss] event loop idle metrics

Now that the patch has landed in libuv v1.39.0 I'll create a PR with this feature once it has landed in node.

jasnell

comment created time in a month

issue openednodejs/node

Race condition in the inspector calls WriteRaw() on nullptr

  • Version: v12.18.3
  • Platform: Linux 4.19.127 x86_64
  • Subsystem: inspector

NOTE: Unable to reproduce this in v14.8.0.

What steps will reproduce the bug?

A race condition causing the process to abort can be triggered by running test-inspector-wait-for-connection.js in a loop.

To make things easier, first apply this patch:

diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc
index a7019281af..b9d7f85507 100644
--- a/src/inspector_socket.cc
+++ b/src/inspector_socket.cc
@@ -609,6 +609,7 @@ ProtocolHandler::ProtocolHandler(InspectorSocket* inspector,
 
 int ProtocolHandler::WriteRaw(const std::vector<char>& buffer,
                               uv_write_cb write_cb) {
+  CHECK_NOT_NULL(tcp_);
   return tcp_->WriteRaw(buffer, write_cb);
 }

Fortunately this can be reproduced with a debug build. So I use the following to reproduce it:

for i in $(seq 1 1000)
  do echo -ne "$i\r"
  ./out/Debug/node test/parallel/test-inspector-wait-for-connection.js
  if [[ $? -ne 0 ]] || [[ -f "./core" ]]; then
    break
  fi
done

How often does it reproduce? Is there a required condition?

Usually triggers the abort within running the test every 100 times.

Additional information

The specific issue is that ProtocolHandler::WriteRaw() attempts a write to tcp_ when tcp_ == 0x0.

Additional debug information from lldb:

(lldb) bt
* thread #1, name = 'node', stop reason = signal SIGABRT
    ...
    frame #3: node`node::Assert(info=0x0000000002c5d938) at node_errors.cc:253:3
    frame #4: node`node::inspector::ProtocolHandler::WriteRaw(this=0x00007f9c680011b0, buffer=size=1, write_cb=(node`node::inspector::(anonymous namespace)::WriteRequest::Cleanup(uv_write_s*, int) at inspector_socket.cc:123))(uv_write_s*, int)) at inspector_socket.cc:612:3
    frame #5: node`node::inspector::(anonymous namespace)::WsHandler::Write(this=0x00007f9c680011b0, data=<unavailable>) at inspector_socket.cc:351:5
    frame #6: node`node::inspector::InspectorSocket::Write(this=0x00007f9c68001740, data="{\"method\":\"Runtime.executionContextDestroyed\",\"params\":{\"executionContextId\":1}}", len=80) at inspector_socket.cc:769:22
    frame #7: node`node::inspector::SocketSession::Send(this=0x00007f9c680015f0, message=") at inspector_socket_server.cc:495:15
    frame #8: node`node::inspector::InspectorSocketServer::Send(this=0x00007f9c84a7e9f8, session_id=1, message=") at inspector_socket_server.cc:481:14
    ...

(lldb) f 4
frame #4: 0x0000000000ff2017 node`node::inspector::ProtocolHandler::WriteRaw(this=0x00007f9c680011b0, buffer=size=1, write_cb=(node`node::inspector::(anonymous namespace)::WriteRequest::Cleanup(uv_write_s*, int) at inspector_socket.cc:123))(uv_write_s*, int)) at inspector_socket.cc:612:3
   609 
   610  int ProtocolHandler::WriteRaw(const std::vector<char>& buffer,
   611                                uv_write_cb write_cb) {
-> 612    CHECK_NOT_NULL(tcp_);
   613    return tcp_->WriteRaw(buffer, write_cb);
   614  }
   615

(lldb) fr v
(node::inspector::(anonymous namespace)::WsHandler *) this = 0x00007f9c680011b0
(const std::vector<char, std::allocator<char> > &) buffer = size=1: {
  std::_Vector_base<char, std::allocator<char> > = {
    _M_impl = (_M_start = "\x81P{\"method\":\"Runtime.executionContextDestroyed\",\"params\":{\"executionContextId\":1}}", _M_finish = "", _M_end_of_storage = "")
  }
}
(uv_write_cb) write_cb = 0x0000000000ff4790 (node`node::inspector::(anonymous namespace)::WriteRequest::Cleanup(uv_write_s*, int) at inspector_socket.cc:123)


(lldb) p tcp_
(node::inspector::TcpHolder::Pointer) $0 = nullptr {
  pointer = 0x0000000000000000
}

created time in a month

issue openednodejs/node

Race condition leading to hanging process in test-http2-reset-flood.js

  • Version: v12.18.3
  • Platform: Linux 4.19.127 x86_64
  • Subsystem: test

What steps will reproduce the bug?

Need to run the test a lot. I use this and wait for the process to hang.

for i in $(seq 1 1000)
  do echo -ne "$i\r"
  ./node test/parallel/test-http2-reset-flood.js
  if [[ $? -ne 0 ]]; then
    break
  fi
done

How often does it reproduce? Is there a required condition?

Can usually cause the test to hang within running the test 1000 times.

Additional information

Seems two handles stay alive after the test has finished. Below is the best debugging information I could get from a Release build, since I wasn't able to reproduce with a Debug build.

(lldb) bt
* thread #1, name = 'node', stop reason = signal SIGSTOP
    frame #0: 0x00007efe5a41dd67 libc.so.6`epoll_wait(epfd=13, events=0x00007fffc970aee0, maxevents=1024, timeout=-1) at epoll_wait.c:30
    frame #1: 0x0000000001234d35 node`uv__io_poll(loop=0x0000000002a2a350, timeout=-1) at linux-core.c:309:14
  * frame #2: 0x0000000001225558 node`uv_run(loop=0x0000000002a2a350, mode=UV_RUN_DEFAULT) at core.c:381:5
    frame #3: 0x0000000000a0b4e5 node`node::NodeMainInstance::Run() + 389
    ...

(lldb) p loop->nfds
(unsigned int) $18 = 2

(lldb) expr *((uv_handle_t *) ((char *) (loop->handle_queue[1]) - __builtin_offsetof(uv_handle_t, handle_queue)))
(uv_handle_t) $19 = {
  data = 0x0000000002f50960
  loop = 0x0000000002a2a350
  type = UV_ASYNC
  close_cb = 0x006f00200064006e
  handle_queue = ([0] = 0x0000000002a2a360, [1] = 0x0000000002f507e0)
  u = {
    fd = 4522070
    reserved = ([0] = 0x0020005200450056, [1] = 0x00540020004f0044, [2] = 0x002e005300490048, [3] = 0x0069006800540020)
  }
  next_closing = 0x0000000000000000
  flags = 12
}

(lldb) expr *((uv_handle_t *) ((char *) (0x0000000002f507e0) - __builtin_offsetof(uv_handle_t, handle_queue)))
(uv_handle_t) $20 = {
  data = 0x0000000002f50720
  loop = 0x0000000002a2a350
  type = UV_TTY
  close_cb = 0x0000000000000000
  handle_queue = ([0] = 0x0000000002f509e8, [1] = 0x0000000002f4be48)
  u = {
    fd = 6619236
    reserved = ([0] = 0x0072007200650064, [1] = 0x007300650064002e, [2] = 0x0079006f00720074, [3] = 0x006e006f006f0053)
  }
  next_closing = 0x0000000000000000
  flags = 49160
}

Not even sure if this is worth fixing, but leaving it here for reference. I've had a couple other tests do something similar, but it's harder to reproduce with those.

NOTE: Can't reproduce this in v14.8.0.

created time in a month

push eventtrevnorris/libuv

TK-one

commit sha e8644693ea2449360e2f06c8b5792e923ab4aeef

doc: fix header file location PR-URL: https://github.com/libuv/libuv/pull/2720 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

Ben Noordhuis

commit sha 70469dcaa65bc4608e896b4df1ad13fcf58ad984

unix: fix signal handle closing deferral The way libuv handled closing of `uv_signal_t` handles with pending events introduced an infidelity where `uv_loop_alive()` returned false while the signal handle was still in the closing-but-not-closed state. Fixes: https://github.com/libuv/libuv/issues/2721 PR-URL: https://github.com/libuv/libuv/pull/2722 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

view details

Xu Meng

commit sha af7143b6f28ad60243cfa04d240deeec5d242e0f

ibmi: set the amount of memory in use to zero On IBMi PASE, the amount of memory in use includes storage used for memory and disks. So we hard-code the amount of memory in use to zero on IBMi, based on discussion in nodejs/node#32043. PR-URL: https://github.com/libuv/libuv/pull/2732 Refs: https://github.com/nodejs/node/pull/32043 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Milad Farazmand

commit sha b5155dd2accad94c86dc89ad43d79d30dd9c971a

zos: return on realloc failure in scandir() Fixes: https://github.com/libuv/libuv/issues/2692 PR-URL: https://github.com/libuv/libuv/pull/2693 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

Ben Noordhuis

commit sha a9974da019b5942a2f38bb6a170a42645afd966a

zos: fix scandir() error path NULL pointer deref Commit b5155dd2 ("zos: return on realloc failure in scandir()") introduced a bug where `nl` is dereferenced when it's NULL after reallocation fails. PR-URL: https://github.com/libuv/libuv/pull/2734 Refs: https://github.com/libuv/libuv/pull/2693 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

cjihrig

commit sha e45f1ec38db882f8dc17b51f51a6684027034609

2020.03.12, Version 1.35.0 (Stable) Changes since version 1.34.2: * src: android build fix (David Carlier) * build: make code compilable for iOS on Xcode (ssrlive) * ibmi: skip unsupported fs test cases (Xu Meng) * ibmi: ensure that pipe backlog is not zero (Xu Meng) * test,udp6: fix udp_ipv6 test flakiness (Jameson Nash) * test: fix fs_event_watch_dir_recursive flakiness (Santiago Gimeno) * pipe: disallow listening on an IPC pipe (Witold Kręcicki) * build,cmake: improve buil experience (Isabella Muerte) * unix: remove support for FreeBSD < 10 (Saúl Ibarra Corretgé) * linux: simplify uv__accept() (Ben Noordhuis) * linux: assume presence of SOCK_CLOEXEC flag (Ben Noordhuis) * linux: simplify uv__dup2_cloexec() (Ben Noordhuis) * freebsd,linux: simplify uv__make_socketpair() (Ben Noordhuis) * unix: fix error handling in uv__make_socketpair() (Ben Noordhuis) * freebsd,linux: simplify uv__make_pipe() (Ben Noordhuis) * unix: fix error handling in uv__make_pipe() (Ben Noordhuis) * linux: simplify uv__async_eventfd() (Ben Noordhuis) * linux: assume the presence of inotify system calls (Ben Noordhuis) * doc: strip ICC profile from 2 jpg files (Dominique Dumont) * unix: make uv_tcp_keepalive predictable (Manuel BACHMANN) * docs: uv_setup_args() may take ownership of argv (Ben Noordhuis) * unix: fix error path in uv_setup_args() (Ben Noordhuis) * unix: fix size check in uv_get_process_title() (Ben Noordhuis) * doc: add erw7 to maintainers (erw7) * test: fixed udp4_echo_server implementation (Marek Vavrusa) * test: added udp ping benchmark (1,10,100 pingers) (Marek Vavrusa) * freebsd,linux: add recvmmsg() + sendmmsg() udp implementation (Marek Vavrusa) * win,pipe: DRY/simplify some code paths (Jameson Nash) * win: address some style nits (Jameson Nash) * win,pipe: ensure `req->event_handle` is defined (Elliot Saba) * win,pipe: consolidate overlapped initialization (Elliot Saba) * win,pipe: erase event_handle after deleting pointer (Jameson Nash) * build: fix android cmake build, build missing file (Ben Noordhuis) * test: skip some UDP tests on IBMi (Xu Meng) * test: skip some spawn test cases on IBMi (Xu Meng) * src: fix wrong method name in comment (TK-one) * test: add UV_TIMEOUT_MULTIPLIER environment var (Ben Noordhuis) * unix: fix uv_cpu_info always returning UV_ENOTDIR on OpenBSD (Ben Davies) * test: skip the pwd_shell test on IBMi (Xu Meng) * win,tty: Change to restore cursor shape with uv_tty_reset() (erw7) * win,tty: Added set cursor style to CSI sequences (erw7) * test: handle EINTR, fix EOF check in poll test (Ben Noordhuis) * unix: use socklen_t instead of size_t (Ben Noordhuis) * doc: fix header file location (TK-one) * unix: fix signal handle closing deferral (Ben Noordhuis) * ibmi: set the amount of memory in use to zero (Xu Meng) * zos: return on realloc failure in scandir() (Milad Farazmand) * zos: fix scandir() error path NULL pointer deref (Ben Noordhuis)

view details

cjihrig

commit sha 87ee20d5128402e0f826941370954d302119d085

Add SHA to ChangeLog

view details

cjihrig

commit sha 584ba94885619d75968a7c083914fd8b75442813

Now working on version 1.35.1 Fixes: https://github.com/libuv/libuv/issues/2709

view details

Jesse Gorzinski

commit sha 742e0ba7dfba344484bba2493a8c5ddf164a8c30

build: add aix-common.c for AIX cmake build PR-URL: https://github.com/libuv/libuv/pull/2731 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>

view details

Irek Fakhrutdinov

commit sha f06734057b81eaffb35ebe25d5740e3942daf129

zos: explicitly mark message queue events The os390 epoll_wait implementation uses poll() to detect events in both file descriptors and the message queue used for file system events. The only message queue ID is always placed at the end of the array passed to the poll() call. When the poll() call returns all FDs and the message queue are checked for events by iterating through that array. In order to distinguish the message queue from the FDs its ID value is compared with the only message queue ID we have and if it matches the message queue handler function is called. When the message queue ID is relatively small, it may have the same value as the value of one of the file descriptors. If this happens, the message queue handler is called for the matching file descriptor, and this call fails. The file descriptor ends up being unhandled and this makes the next poll() call to return immediately. Eventually this will happen again and again, leading to an infinite busy loop and high CPU usage. To prevent the incorrect interpretation of file descriptors as the message queue, a new field has been added to the epoll event struct. This field is checked instead of the ID value and the message queue handler function is never called for file descriptors. PR-URL: https://github.com/libuv/libuv/pull/2013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

Irek Fakhrutdinov

commit sha 7d988e0763cfe20dc37ac6f33d5fa92d7a397877

zos: move mq check out of loop to save cpu cycles PR-URL: https://github.com/libuv/libuv/pull/2013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

Irek Fakhrutdinov

commit sha 506e4bee7bb1da3a35d8f4ce877549a84b8c5f7b

zos: add checks to ensure behavior of epoll_wait PR-URL: https://github.com/libuv/libuv/pull/2013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Signed-off-by: Irek Fakhrutdinov <ifakhrutdinov@rocketsoftware.com>

view details

Ben Noordhuis

commit sha 1bcfbfd00380c63b5d163b4b70c6469f53df80c0

src: add uv__reallocf() Modeled after FreeBSD's `reallocf(3)`: a version of `realloc(3)` that frees the memory when reallocation fails, simplifying error handling in many cases. PR-URL: https://github.com/libuv/libuv/pull/2735 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Jesse Gorzinski

commit sha 104255f5af57153a9c590a002f53cfb6c15d4dd0

build: ibmi support for cmake PR-URL: https://github.com/libuv/libuv/pull/2729 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Kevin Adler <kadler@us.ibm.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

Lin Zhang

commit sha 055e89f637fcd767096a3b258243c08fc5c93ddf

build: fix gyp build for Android API >= 28 PR-URL: https://github.com/libuv/libuv/pull/2749 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Saúl Ibarra Corretgé

commit sha d9cd7d437d6bcea56355b6e0ef215aa64687d7a1

udp: return recvmmsg-ed datagrams in order When recvmmsg support was added it returned the datagrams in reverse received order, which may impact some applications. To restore the previous behavior, we call recv_cb one last time with nread == 0 and addr == NULL so applications can free the buffer. PR-URL: https://github.com/libuv/libuv/pull/2736 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Richard Lau

commit sha 1099d298d424546b74db11bf6fb7a51b7954fab6

zos,test: fix spawn_empty_env for shared library build z/OS uses LIBPATH instead of LD_LIBRARY_PATH for the search path for shared libraries. PR-URL: https://github.com/libuv/libuv/pull/2737 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Richard Lau

commit sha a9c58e72a34e957fbff6b5020e1a29e32d269115

zos: fix non-Release builds z/OS doesn't support POSIX semaphores. On Release builds the code paths that reference POSIX semaphore functions (e.g. sem_init()) are optimized away so linking succeeds but on a non-Release build the references to the unavailable functions result in unresolved symbol errors. Stub the unavailable POSIX semaphore functions on z/OS as so the code can link on non-Release builds. PR-URL: https://github.com/libuv/libuv/pull/2737 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Richard Lau

commit sha 875a4fe653f93073c14b6eb1a1f8d363583a54b9

zos: fix return value on expired nanosleep() call In the emulated nanosleep() function on z/OS an EAGAIN error from BPX1CTW/BPX4CTW indicates that the timeout has expired. In that case return 0 and not -1. PR-URL: https://github.com/libuv/libuv/pull/2737 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Richard Lau

commit sha c10431165abf0752525dfcb6172bf11a74b9ae62

build: fix z/OS cmake build - Correct CMAKE_SYSTEM_NAME. - Exclude pthread lib on z/OS. - Remove deleted src/unix/pthread-barrier.c. - Set LIBPATH for shared library test. PR-URL: https://github.com/libuv/libuv/pull/2737 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

push time in 2 months

delete branch trevnorris/libuv

delete branch : time-in-provider

delete time in 2 months

issue commentlibuv/libuv

Release proposal: v1.39.0

@bnoordhuis I've uploaded the diff from the first accepted patch in March and the one that landed in v1.x to https://gist.github.com/trevnorris/8183ea638732f908ebb69f962e50b4e0.

I don't have any issue with waiting, but for posterity I want to point out that there was almost no change between the patch as it was accepted in March and as it landed today. The only major differences between the two are a mistake that accidentally broke ABI:

@@ include/uv.h: typedef struct uv_utsname_s uv_utsname_t;
  typedef enum {
 -  UV_LOOP_BLOCK_SIGNAL
-+  UV_LOOP_BLOCK_SIGNAL = 1,
-+  UV_METRICS_IDLE_TIME = 2
++  UV_LOOP_BLOCK_SIGNAL = 0,
++  UV_METRICS_IDLE_TIME
  } uv_loop_option;

and a bug fix for calculating idle time in Windows.

@@ src/win/core.c: static void uv__poll_wine(uv_loop_t* loop, DWORD timeout) {
 +      timeout = user_timeout;
 +      reset_timeout = 0;
 +    }
++
++    /* Placed here because on success the loop will break whether there is an
++     * empty package or not, or if GetQueuedCompletionStatus returned early then
++     * the timeout will be updated and the loop will run again. In either case
++     * the idle time will need to be updated.
++     */
++    uv__metrics_update_idle_time(loop);
 +
      if (overlapped) {
-+      uv__metrics_update_idle_time(loop);
@@ src/win/core.c: static void uv__poll(uv_loop_t* loop, DWORD timeout) {
 +    if (reset_timeout != 0) {
 +      timeout = user_timeout;
 +      reset_timeout = 0;
 +    }
++
++    /* Placed here because on success the loop will break whether there is an
++     * empty package or not, or if GetQueuedCompletionStatus returned early then
++     * the timeout will be updated and the loop will run again. In either case
++     * the idle time will need to be updated.
++     */
++    uv__metrics_update_idle_time(loop);
 +
      if (success) {
        for (i = 0; i < count; i++) {
          /* Package was dequeued, but see if it is not a empty package
           * meant only to wake us up.
           */
          if (overlappeds[i].lpOverlapped) {
-+          uv__metrics_update_idle_time(loop);
cjihrig

comment created time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

@vtjnash Thanks a lot for helping this make it through.

trevnorris

comment created time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

I forgot to remove the struct mthread_t from test/test-metrics.c after rewriting the tests. So just removed that and rebased it on latest v1.x. No other changes.

trevnorris

comment created time in 2 months

push eventtrevnorris/libuv

Juan Sebastian velez Posada

commit sha f7d162477a777a01b182a6f053fe5b5252bd5197

docs: improve the descriptions for get memory info PR-URL: https://github.com/libuv/libuv/pull/2780 Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Ryan Liptak

commit sha 540d723fa43eb72e2097c78373124f108f17f327

test: add udp-mmsg test PR-URL: https://github.com/libuv/libuv/pull/2818 Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Ryan Liptak

commit sha 6b5aa669db4d57231e21b1ee97c63a06167e117e

udp: add uv_udp_using_recvmmsg query Allows for determining if a buffer large enough for multiple dgrams should be allocated in alloc_cb of uv_udp_recvstart, for example. Contributes towards #2822. PR-URL: https://github.com/libuv/libuv/pull/2830 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Trevor Norris

commit sha f6a6d6af10cedf3cfcbcdbe0e13b372149fad131

zos: fix potential event loop stall This is a port of 70002c80 to z/OS to fix the same potential issue that could effectively enter an infinite loop (but not a busy loop) under certain conditions when polling for events.

view details

Trevor Norris

commit sha 7b1a7d2559e7dd8d3130893d6e0cbaa12948126d

include: add internal fields struct to uv_loop_t Add struct `uv__loop_internal_fields_t` as a location for future additions to `uv_loop_t` while also maintaining v1.x compatibility. Currently `uv__loop_internal_fields_t` only contains the `flags` field. The reason for adding the `flags` field is because the same field was never added to `UV_LOOP_PRIVATE_FIELDS` in Windows as it was in Unix. The idea for creating a struct and attaching it to `uv_loop_t` for future API enhancements was taken from a comment by bnoordhuis in: https://github.com/libuv/libuv/issues/2506#issuecomment-540050665 Also add `internal_fields` to `uv_loop_t` to store the pointer to `uv__loop_internal_fields_t`. This naming makes more sense than just using `active_reqs.unused[1]`. To maintain ABI compatibility, shrink the `unused` array.

view details

Trevor Norris

commit sha 6975c49510facc5557aaa9ffb377a48b8cb2f1b5

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

push time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

@vtjnash @santigimeno I've updated and cleaned up the PR. Tests should be passing on Windows. The bug came from me overlooking this comment in uv__poll():

      /* GetQueuedCompletionStatus can occasionally return a little early.
       * Make sure that the desired timeout target time is reached.
       */

The result was that the internal tracking mechanism for when poll was entered was being unexpectedly reset. So placement of uv__metrics_update_idle_time() has been changed to accommodate that (along with a code comment explaining for the reasoning behind the change).

Should be ready for CI.

trevnorris

comment created time in 2 months

push eventtrevnorris/libuv

Trevor Norris

commit sha c785eb73cffe140da3d1dd0c287de88067059f79

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

push time in 2 months

push eventtrevnorris/libuv

Trevor Norris

commit sha 67399b3436369676a20996b054dd2e8aad545a2a

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

Trevor Norris

commit sha d2f871a634c7324d4b677237b9b391d19a58ebf2

FIXUP implement changes to test Increase the duration of test, and the delta to test them by per suggestion in the PR.

view details

push time in 2 months

push eventtrevnorris/libuv

Trevor Norris

commit sha 2155e0ee77b146f447b37b458967a1404ebfb59d

FIXUP test Windows fix

view details

push time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

Bummer. Same failure. I'm now managing to reproduce it on my Windows VM. I'm confused why this is happening on a spawned thread. Even when I only spawn a single thread, and use the noop timer callback, it still shows an extremely low idle time. Will give this another look tomorrow.

trevnorris

comment created time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

@vtjnash I've added a commit with the changes to the test. I've done a 1 sec timer timeout and check the idle time to ±500 ms. Also in the timer's callback I spin for 600 ms to possibly force the idle time return over the ±500 ms leeway.

If the changes to the test are acceptable then I'll squash the last commit.

trevnorris

comment created time in 2 months

push eventtrevnorris/libuv

Trevor Norris

commit sha e741e81d6f030cd9279c67cb44ccda6d22159687

include: add internal fields struct to uv_loop_t Add struct `uv__loop_internal_fields_t` as a location for future additions to `uv_loop_t` while also maintaining v1.x compatibility. Currently `uv__loop_internal_fields_t` only contains the `flags` field. The reason for adding the `flags` field is because the same field was never added to `UV_LOOP_PRIVATE_FIELDS` in Windows as it was in Unix. The idea for creating a struct and attaching it to `uv_loop_t` for future API enhancements was taken from a comment by bnoordhuis in: https://github.com/libuv/libuv/issues/2506#issuecomment-540050665 Also add `internal_fields` to `uv_loop_t` to store the pointer to `uv__loop_internal_fields_t`. This naming makes more sense than just using `active_reqs.unused[1]`. To maintain ABI compatibility, shrink the `unused` array.

view details

Trevor Norris

commit sha 149d98341796763d3e34dc296d437eb77495bb03

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

Trevor Norris

commit sha e60e34ab3d7f14f3d3b5dec23da6c3bfa678a8c2

FIXUP implement changes to test Increase the duration of test, and the delta to test them by per suggestion in the PR.

view details

push time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

@vtjnash I'm fine with that if everyone else is. Just didn't want a single test to take too long to run. I'll make the change now.

trevnorris

comment created time in 2 months

pull request commentlibuv/libuv

Add API for measuring event loop idle time

@vtjnash Thanks for pointing that out. I've made the change and rebased on latest v1.x.

I think this provides a reasonable framework that other times could be added later, if there was value, or that this can be changed to be more accurate, if other data becomes available.

That hits exactly why this PR was designed the way it was. Internally I've extended this to collect various other metrics, but before contributing those I wanted to make sure this approach would be accepted.

trevnorris

comment created time in 2 months

push eventtrevnorris/libuv

Ben Noordhuis

commit sha 10a9c25a125185968809d65de901d23183df8150

unix: use relaxed loads/stores for clock id This was part of commit c70dd705 ("unix: use relaxed loads/stores for feature checks") and was reviewed as such but I accidentally dropped it in the rebase before the final merge. Fixes: https://github.com/libuv/libuv/issues/2884 PR-URL: https://github.com/libuv/libuv/pull/2886 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

George Zhao

commit sha fd0e24d2cb4c59eeeb24e8b7c81c3a783b689213

build,win: link to user32.lib and advapi32.lib PR-URL: https://github.com/libuv/libuv/pull/2908 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

ssrlive

commit sha 1e60e85ac54190e48b6bc24be773784511f0293c

unix: squelch harmless valgrind warning PR-URL: https://github.com/libuv/libuv/pull/2895 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

view details

Turbinya

commit sha e0cb4f06c9c171028092f3cb515e4523eb824066

include: fx c++ style comments warnings PR-URL: https://github.com/libuv/libuv/pull/2890 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

OleksandrKvl

commit sha 12be29f185261b8a7e6ada596fd805919cb2b133

unix,stream: clear read/write states on close/eof Fixes: https://github.com/libuv/libuv/issues/1798 Refs: https://github.com/libuv/libuv/pull/1825 PR-URL: https://github.com/libuv/libuv/pull/2409 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Co-Authored-By: Jameson Nash <vtjnash@gmail.com>

view details

erw7

commit sha 66632e7a44191db638ab0353db95cda96a3409bf

build,cmake: Change installation location on MinGW MinGW prefers a POSIX like file system hierarchy. Therefore, it is appropriate that the installation destination is the same as UNIX. PR-URL: https://github.com/libuv/libuv/pull/2697 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Carter Li

commit sha ca10e361498dc55669dc0e630ca4481f2d74eca9

linux: use copy_file_range for uv_fs_copyfile when possible Refs: https://github.com/libuv/libuv/issues/925#issuecomment-234696227 PR-URL: https://github.com/libuv/libuv/pull/2352 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Michael Penick

commit sha f779fd4f0585ef1b0fc9634626ef141509cd0b80

win,tcp: avoid reinserting a pending request (#2688) This fix avoids inserting a duplicate pending request in the case where `WSARecv()` returns an error (e.g. when a connection has been terminated by its peer) when `uv_read_start()` is called in a read callback. Fixes: https://github.com/libuv/libuv/issues/2687 PR-URL: https://github.com/libuv/libuv/pull/2688 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com>

view details

Trevor Norris

commit sha 208e86aeef15c0bca950ff1e259c9f5c7c71ba89

zos: fix potential event loop stall This is a port of 70002c80 to z/OS to fix the same potential issue that could effectively enter an infinite loop (but not a busy loop) under certain conditions when polling for events.

view details

Trevor Norris

commit sha 75c83f2584a79fe25151f9dd129802d7e18cac68

include: add internal fields struct to uv_loop_t Add struct `uv__loop_internal_fields_t` as a location for future additions to `uv_loop_t` while also maintaining v1.x compatibility. Currently `uv__loop_internal_fields_t` only contains the `flags` field. The reason for adding the `flags` field is because the same field was never added to `UV_LOOP_PRIVATE_FIELDS` in Windows as it was in Unix. The idea for creating a struct and attaching it to `uv_loop_t` for future API enhancements was taken from a comment by bnoordhuis in: https://github.com/libuv/libuv/issues/2506#issuecomment-540050665 Also add `internal_fields` to `uv_loop_t` to store the pointer to `uv__loop_internal_fields_t`. This naming makes more sense than just using `active_reqs.unused[1]`. To maintain ABI compatibility, shrink the `unused` array.

view details

Trevor Norris

commit sha 3a710c65dd960c29511c511dc566700bdcda95b7

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

push time in 2 months

push eventtrevnorris/libuv

Ben Noordhuis

commit sha 4685be236b032ec6a60553a99d4365ab25dc368a

darwin: work around clock jumping back in time It was reported that mach_absolute_time() can jump backward in time when the machine is suspended. Use mach_continuous_time() when available to work around that (macOS 10.12 and up.) Fixes: https://github.com/libuv/libuv/issues/2891 PR-URL: https://github.com/libuv/libuv/pull/2894 Reviewed-By: Phil Willoughby <philwill@fb.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

view details

Santiago Gimeno

commit sha 84305d856090ca96af1e10e34a106d2379ba9067

udp: fix write_queue cleanup on sendmmsg error This issue manifested on `connected` udp sockets trying to send datagrams to a non-existent server and returning `ECONNREFUSED` because an ICMP error was received before the actual sending was performed. PR-URL: https://github.com/libuv/libuv/pull/2899 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

David Carlier

commit sha 40bab5ed71dc046eb83eead197f037c44a090cc6

src: build fix for Android pipe2 needs GNU source defined. PR-URL: https://github.com/libuv/libuv/pull/2857 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>

view details

cjihrig

commit sha e8b989ea1f7f9d4083511a2caec7791e9abd1871

2020.07.04, Version 1.38.1 (Stable) Changes since version 1.38.0: * test: use last matching qemu version (cjihrig) * win, util: rearrange uv_hrtime (Bartosz Sosnowski) * test: skip signal_multiple_loops test on QEMU (gengjiawen) * build: add android build to CI (gengjiawen) * test: extend fs_event_error_reporting timeout (cjihrig) * build: link libkvm on netbsd only (Alexander Tokmakov) * linux: refactor /proc file reader logic (Ben Noordhuis) * linux: read load average from /proc/loadavg (Ben Noordhuis) * android: remove patch code for below 21 (gengjiawen) * win: fix visual studio 2008 build (Arenoros) * win,tty: fix deadlock caused by inconsistent state (lander0s) * unix: use relaxed loads/stores for feature checks (Ben Noordhuis) * build: don't .gitignore m4/ax_pthread.m4 (Ben Noordhuis) * unix: fix gcc atomics feature check (Ben Noordhuis) * darwin: work around clock jumping back in time (Ben Noordhuis) * udp: fix write_queue cleanup on sendmmsg error (Santiago Gimeno) * src: build fix for Android (David Carlier)

view details

cjihrig

commit sha 5b0398262a3f760340382b2d4fac82a89bb642e6

Add SHA to ChangeLog

view details

cjihrig

commit sha 032f2b1251be842438bfed6e688ef874bf85254c

Now working on version 1.38.2 Fixes: https://github.com/libuv/libuv/issues/2898

view details

Trevor Norris

commit sha f33f755d333bde53d5644f325b1afc091ca345c5

zos: fix potential event loop stall This is a port of 70002c80 to z/OS to fix the same potential issue that could effectively enter an infinite loop (but not a busy loop) under certain conditions when polling for events.

view details

Trevor Norris

commit sha 8746a3e9c72c38a799e5cdd1e9f49cbd8c83f649

include: add internal fields struct to uv_loop_t Add struct `uv__loop_internal_fields_t` as a location for future additions to `uv_loop_t` while also maintaining v1.x compatibility. Currently `uv__loop_internal_fields_t` only contains the `flags` field. The reason for adding the `flags` field is because the same field was never added to `UV_LOOP_PRIVATE_FIELDS` in Windows as it was in Unix. The idea for creating a struct and attaching it to `uv_loop_t` for future API enhancements was taken from a comment by bnoordhuis in: https://github.com/libuv/libuv/issues/2506#issuecomment-540050665 Also add `internal_fields` to `uv_loop_t` to store the pointer to `uv__loop_internal_fields_t`. This naming makes more sense than just using `active_reqs.unused[1]`. To maintain ABI compatibility, shrink the `unused` array.

view details

Trevor Norris

commit sha b08852045b22dc5b33a6f6215de3a4314a0bb7fb

unix,win: add API to measure event loop idle time The API addition `uv_metrics_idle_time()` is a thread safe call that allows the user to retrieve the amount of time the event loop has spent in the kernel's event provider (i.e. poll). It was done this way to allow retrieving this value without needing to interrupt the execution of the event loop. This option can be enabled by passing `UV_METRICS_IDLE_TIME` to `uv_loop_configure()`. One important aspect of this change is, when enabled, to always first call the event provider with a `timeout == 0`. This allows libuv to know whether any events were waiting in the event queue when the event provider was called. The importance of this is because libuv is tracking the amount of "idle time", not "poll time". Thus the provider entry time is not recorded when `timeout == 0` (the event provider never idles in this case). While this does add a small amount of overhead, when enabled, but the overhead decreases when the event loop has a heavier load. This is because poll events will be waiting when the event provider is called. Thus never actually recording the provider entry time. Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always happens in `uv__metrics_set_provider_entry_time()` and `uv__metrics_update_idle_time()`. Making the conditional logic wrapping each call simpler and allows for instrumentation to always hook into those two function calls. Rather than placing the fields directly on `uv__loop_internal_fields_t` add the struct `uv__loop_metrics_t` as a location for future metrics API additions. Tests and additional documentation has been included.

view details

push time in 3 months

more