profile
viewpoint

addaleax/actual-crash 3

Node.js native addon that just crashes

addaleax/angular-events-calendar 2

Calendar in the style of GitHub contributions

addaleax/argon2-ffi 1

Node.js bindings for argon2, the winner of the Password Hashing Competition (PHC)

addaleax/builtin-modules 1

List of the Node.js builtin modules

addaleax/checkref 1

Check your HTML and Markdown for invalid local links & anchors

addaleax/0x 0

🔥 single-command flamegraph profiling 🔥

addaleax/7z-stream 0

7z-stream is a streaming 7z parser.

addaleax/admin 0

Facilitating joint collaboration amongst the TSC and CommComm

addaleax/angular-gettext 0

Gettext support for Angular.js

pull request commentnodejs/node

crypto: add randomInt function

@nodejs/crypto Any other reviews?

olalonde

comment created time in 32 minutes

PR opened nodejs/node

test: use process.env.PYTHON to spawn python

Fixes: https://github.com/nodejs/node/issues/34699

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+4 -2

0 comment

2 changed files

pr created time in an hour

push eventaddaleax/node

Anna Henningsen

commit sha 3b12b5a7f27c7e764ed366e345a21bb41931127c

test: use process.env.PYTHON to spawn python Co-authored-by: Jérémy Lal <kapouer@melix.org> Fixes: https://github.com/nodejs/node/issues/34699

view details

push time in an hour

create barnchaddaleax/node

branch : fix-34699

created branch time in an hour

pull request commentnodejs/node

src: remove redundant else block

@juanarbol Fwiw, you’re not the first one who ran into this, so it might be worth adding a comment here that this is intentional (especially considering that this PR already had 4 approvals)

juanarbol

comment created time in 2 hours

issue commentnodejs/node

worker_threads memory leak

@jetibest Thanks for the comment!

The issue goes away for me when passing the --no-concurrent-array-buffer-sweeping --no-concurrent-array-buffer-freeing flags to Node.js, so I think it’s safe to say that this is a V8 bug.

Could you open a new issue here and on https://bugs.chromium.org/p/v8/issues/ (and mention that setting those flags works around the problem)?

aleks63

comment created time in 7 hours

pull request commentnodejs/node

src: remove redundant else block

@bridgear No – this is als the cause of the failures in the WASI tests here, I assume.

More generally, in C++

if (x) {
  some_variable a;
  do_something(); 
} else {
  do_something(); 
}

and

if (x) {
  some_variable a;
}
do_something(); 

are not equivalent if the destructor of a influences do_something() in some way (which is the case here).

juanarbol

comment created time in 7 hours

pull request commentnode-ffi-napi/ref-napi

Add support for NAPI 6

Hi @calumsult, and thanks for the PR! I have a few questions:

  • What advantage does this have over looking up the symbol? Was there any particular problem with the current code?
  • How would you like this to be published? We provide prebuilt binaries for ref-napi, and they can only publish one particular version of the addon at a time.
  • Publishing a version of ref-napi that links the functions directly would increase the requirements to a version of Node.js that supports N-API 6. That would be a breaking change, to my understanding. Is that worth it?
calumsult

comment created time in 7 hours

Pull request review commentnodejs/node

src: prefer uv_gettimeofday over gettimeofday(2)

 void DiagnosticFilename::LocalTime(TIME_TYPE* tm_struct) { #ifdef _WIN32   GetLocalTime(tm_struct); #else  // UNIX, OSX-  struct timeval time_val;-  gettimeofday(&time_val, nullptr);+  uv_timeval64_t time_val;+  CHECK_EQ(0, uv_gettimeofday(&time_val));   localtime_r(&time_val.tv_sec, tm_struct);

Yes, looks like at least the ARM build is failing. It’s probably easiest to keep this as-is?

juanarbol

comment created time in 12 hours

Pull request review commentnodejs/node

src: prefer uv_gettimeofday over gettimeofday(2)

 void DiagnosticFilename::LocalTime(TIME_TYPE* tm_struct) { #ifdef _WIN32   GetLocalTime(tm_struct); #else  // UNIX, OSX-  struct timeval time_val;-  gettimeofday(&time_val, nullptr);+  uv_timeval64_t time_val;+  CHECK_EQ(0, uv_gettimeofday(&time_val));   localtime_r(&time_val.tv_sec, tm_struct);

This changes the type here of &time_val.tv_sec from time_t* to int64_t*, which might not be the same pointer types. Isn’t that an issue? (I’ll kick off CI to see if it’s a problem on one of our supported platforms, but obviously there are and have been platforms where time_t is a 32-bit type.)

juanarbol

comment created time in 12 hours

PR opened nodejs/node

test: modernize test-cluster-master-error

Some stylistic changes to bring this more in line with what our tests currently look like, and add a note about general flakiness.

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+8 -30

0 comment

1 changed file

pr created time in a day

create barnchaddaleax/node

branch : test-cluster-master-error

created branch time in a day

push eventnodejs/node

Anna Henningsen

commit sha 2dbd15a075cd4635b79aae98f8ebac5360a236de

src: fix linter failures Fix linter failures when running the linter on all source files. PR-URL: https://github.com/nodejs/node/pull/34582 Refs: https://github.com/nodejs/node/pull/34565 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

view details

Anna Henningsen

commit sha 05100e1eec748e5b65463dfd003aa6e93f567408

tools: fix C++ import checker argument expansion Makefile assumes that it can pass a list of files to the import checker, whereas the import checker expects a single argument that is interpreted as a blob. Fix that mismatch by accepting multiple arguments in the import checker. Refs: https://github.com/nodejs/node/pull/34565 PR-URL: https://github.com/nodejs/node/pull/34582 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

view details

push time in a day

push eventnodejs/node

James M Snell

commit sha 16aa92721666d5db3c9d4e1df6a71e496da811dc

async_hooks: add AsyncResource.bind utility Creates an internal AsyncResource and binds a function to it, ensuring that the function is invoked within execution context in which bind was called. PR-URL: https://github.com/nodejs/node/pull/34574 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>

view details

Gerhard Stoebich

commit sha 0af9bee4c3c4b53f2cdb398bbf764baaaea7759b

async_hooks: improve property descriptors in als.bind The length property should be non enumerable to match behavior of normal functions. The asyncResource property is enumerable and therefore it should be also writable to avoid issues like there: https://github.com/nodejs/node/pull/30932#discussion_r379679982 Both properties should be configurable. Refs: https://github.com/nodejs/node/pull/34574 PR-URL: https://github.com/nodejs/node/pull/34620 Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Gerhard Stoebich

commit sha 0a51aa8fdb37771c5f5ee88e5b082ae3c1603d56

async_hooks: avoid unneeded AsyncResource creation Inspired by the callstack at https://github.com/nodejs/node/issues/34556#issuecomment-666743528 If the wanted store is equal to the active store it's not needed to create an AsyncResource. Refs: https://github.com/nodejs/node/issues/34556#issuecomment-666743528 PR-URL: https://github.com/nodejs/node/pull/34616 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>

view details

Anna Henningsen

commit sha e89ec46ba905d00ce5b228201fcb38344c3fe0f5

n-api,src: provide asynchronous cleanup hooks Sometimes addons need to perform cleanup actions, for example closing libuv handles or waiting for requests to finish, that cannot be performed synchronously. Add C++ API and N-API functions that allow providing such asynchronous cleanup hooks. Fixes: https://github.com/nodejs/node/issues/34567 PR-URL: https://github.com/nodejs/node/pull/34572 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>

view details

Gerhard Stoebich

commit sha 650248922b1fc5ee40bc5f7136bd02aa9fd24137

async_hooks: avoid GC tracking of AsyncResource in ALS Manually destroy the AsyncResource created by AsyncLocalStore.run() to avoid unneeded GC tracking in case a destroy hooks is present. PR-URL: https://github.com/nodejs/node/pull/34653 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Anna Henningsen

commit sha fbd411d28a0f61e2af44ec25c503b70cfd70890a

n-api: fix use-after-free with napi_remove_async_cleanup_hook Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572 PR-URL: https://github.com/nodejs/node/pull/34662 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Rich Trott

commit sha b78278b92229fa697a444d27adf3dc01a457080c

doc: use _Class Method_ in async_hooks.md We use _Class Method_ rather than _static_ in documentation headers in buffer.md and crypto.md. We use _static_ in one place in async_hooks.md. Change to _Class Method_ for consistency. PR-URL: https://github.com/nodejs/node/pull/34626 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

view details

Anna Henningsen

commit sha d1f1f8267a16801eb8a66879e8b46f769a7f1936

src: fix linter failures Fix linter failures when running the linter on all source files. PR-URL: https://github.com/nodejs/node/pull/34582 Refs: https://github.com/nodejs/node/pull/34565 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

view details

Anna Henningsen

commit sha 928ded3b9d6bc636c2b2acbda70c416304c2ff18

tools: fix C++ import checker argument expansion Makefile assumes that it can pass a list of files to the import checker, whereas the import checker expects a single argument that is interpreted as a blob. Fix that mismatch by accepting multiple arguments in the import checker. Refs: https://github.com/nodejs/node/pull/34565 PR-URL: https://github.com/nodejs/node/pull/34582 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

view details

push time in a day

pull request commentnodejs/node

test: add Actions annotation output

@mmarchini This would need a manual backport to v14.x, unfortunately

mmarchini

comment created time in a day

pull request commentnodejs/node

stream: add catch handler for async _construct

@jasnell This would need a manual backport for v14.x, there’s a bunch of conflicts

jasnell

comment created time in a day

push eventnodejs/node

gengjiawen

commit sha 9ed9ccc5b30089a3f65ac5a0659083c98f49fd47

build: enable build for node-v8 push PR-URL: https://github.com/nodejs/node/pull/34634 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>

view details

Shelley Vohr

commit sha 2cd299b217c3afd303b00cdf7d419de722a9143a

build: run CI on release branches PR-URL: https://github.com/nodejs/node/pull/34649 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>

view details

Gerhard Stoebich

commit sha e45c68af27b0f253baaa9a1f17321edbab9db377

async_hooks: don't read resource if ALS is disabled Only call executionAsyncResource() in getStore() if the ALS instance is enabled because the resource is not needed otherwise. PR-URL: https://github.com/nodejs/node/pull/34617 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

view details

Rich Trott

commit sha 650adeca223639e2fa976292516b9585194dad8e

meta: enable http2 team for CODEOWNERS PR-URL: https://github.com/nodejs/node/pull/34534 Reviewed-By: Anna Henningsen <anna@addaleax.net>

view details

Mateusz Krawczuk

commit sha a7b4318df92d250f0b653e51fc09087e14eb6d71

crypto: add OP flag constants added in OpenSSL v1.1.1 PR-URL: https://github.com/nodejs/node/pull/33929 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Alba Mendez <me@alba.sh> Reviewed-By: Tobias Nießen <tniessen@tnie.de>

view details

aetheryx

commit sha f260bdd57bfe7b6212f738c7e90f0255b57d1aa5

doc: fix typo in path.md PR-URL: https://github.com/nodejs/node/pull/34550 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

iandrc

commit sha dd6bf20e8ff044eb172be784bc6798d67b0d4301

doc: update fs.watch() availability for IBM i Add a line that IBM i does not support `fs.watch()`. Fixes: https://github.com/nodejs/node/issues/34607 Refs: https://nodejs.org/docs/latest/api/fs.html#fs_availability PR-URL: https://github.com/nodejs/node/pull/34611 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Rich Trott

commit sha 2133b18beebcd093e075bb65b93b39b3e8158430

test: add debugging for test-https-foafssl.js The test is timing out once in a very long while on Windows CI. It is unclear where the test gets stuck, so add more debugging statements to try to locate it. Refs: https://github.com/nodejs/node/issues/24397 PR-URL: https://github.com/nodejs/node/pull/34603 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Rich Trott

commit sha ca89c375f7b9066138a81c73dd98d43b12d073ce

test: add debugging for callbacks in test-https-foafssl.js The test is timing out once in a very long while on Windows CI. It is unclear where the test gets stuck, so add more debugging statements to try to locate it. Refs: https://github.com/nodejs/node/issues/24397 PR-URL: https://github.com/nodejs/node/pull/34603 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Rich Trott

commit sha d8e0deaa7cfb527e2a9f92ac1bd214f70cfe0989

doc: edit process.title note for brevity and clarity PR-URL: https://github.com/nodejs/node/pull/34627 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

cjihrig

commit sha dc49561e8d1e48cb9a296d92c71912c80b764f35

deps: update to uvwasi 0.0.10 Notable changes: - The uvwasi_preopen_t now uses const char* for the mapped_path and real_path fields. Previously, these were not `const`. - uvwasi_path_filestat_get() now properly handles the UVWASI_LOOKUP_SYMLINK_FOLLOW flag. - uvwasi_options_init() has been added to reduce the boilerplate code associated with initializing uvwasi_options_t's. - The DEBUG() macro has been renamed to UVWASI_DEBUG() to reduce naming conflicts with other projects. - A compilation error on NetBSD 8.2 has been fixed. - The uvwasi_fd_filestat_set_times() and uvwasi_path_filestat_set_times() functions now have proper implementations. Fixes: https://github.com/nodejs/node/issues/34510 PR-URL: https://github.com/nodejs/node/pull/34623 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

cjihrig

commit sha 2fa24c0ccc62779899956fcaf4e03903ce548a74

wasi: add __wasi_fd_filestat_set_times() test PR-URL: https://github.com/nodejs/node/pull/34623 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Anna Henningsen

commit sha 39ca48c8401aeb29e77973b57a43e614ede44a44

src: fix `size` underflow in CallbackQueue Only decrease the size when actually removing items. PR-URL: https://github.com/nodejs/node/pull/34662 Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Anna Henningsen

commit sha 2761f349ecc480f5bf3ccea07be1242275c8deab

src: spin shutdown loop while immediates are pending This allows using `SetImmediate()` and friends at any point during cleanup. PR-URL: https://github.com/nodejs/node/pull/34662 Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572 Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Evan Lucas

commit sha 6a129d0cf5c33562fdf0d2b90067d3465bd12143

build: do not run auto-start-ci on forks Previously, the auto-start-ci action would run on forks. Without the secrets, the action would fail over and over again. This caused a lot of email spam. Now, we only run this action when the repository is nodejs/node. PR-URL: https://github.com/nodejs/node/pull/34650 Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

rickyes

commit sha 6cd1c4160443e3a6e4bc62021b2f295ed073b8de

doc: add Ricky Zhou to collaborators PR-URL: https://github.com/nodejs/node/pull/34676 Fixes: https://github.com/nodejs/node/issues/34441 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>

view details

gengjiawen

commit sha e1466869724458eb2d4aad245ca1cbf1e1e495e7

test: fix wrong method call PR-URL: https://github.com/nodejs/node/pull/34629 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>

view details

Rich Trott

commit sha 276e2980e2411990df9df821a09f188b0004d0c0

repl: use _REPL_ in user-facing text User-facing error messages should use _REPL_ for the general REPL and not _repl_ which should be reserved for referring to the module itself, etc. _REPL_ is an acronym, so it should be capitalized, as it generally is in documentation in other technologies, and is usually in our own documentation. This fixes a few inconsistent usages in lib/repl.js. PR-URL: https://github.com/nodejs/node/pull/34643 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

Robey Pointer

commit sha b1890e0866ce20ebd0c07d74d1379b1dad61438f

net: don't return the stream object from onStreamRead CallJSOnreadMethod expects the return value to be undefined or a new buffer, so make sure to return nothing, even when an error causes us to destroy the stream. Fixes: https://github.com/nodejs/node/issues/34346 PR-URL: https://github.com/nodejs/node/pull/34375 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

view details

Rich Trott

commit sha ddd339ff45eef2d8c5b43ac62c35ebda96941988

repl: use _Node.js_ in user-facing REPL text We use _node (REPL)_ in one place and _Node.js (REPL)_ in another place in error messages in repl.js. Use _Node.js_ in both places. PR-URL: https://github.com/nodejs/node/pull/34644 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

push time in a day

pull request commentnodejs/node

[v14.x backport] Forces Powershell to use tls1.2

On the one hand, the commit message here should be fixed, on the other hand, it should probably also match the one on master – what do we usually do in that type of situation?

bzoz

comment created time in a day

PR closed nodejs/node

repl: use _Node.js_ in user-facing REPL text author ready repl

We use node (REPL) in one place and Node.js (REPL) in another place in error messages in repl.js. Use Node.js in both places.

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+2 -2

3 comments

2 changed files

Trott

pr closed time in a day

pull request commentnodejs/node

repl: use _Node.js_ in user-facing REPL text

Landed in 989d82fe013def851f76309bcadd2e8847c8ee73

Trott

comment created time in a day

push eventnodejs/node

Rich Trott

commit sha 989d82fe013def851f76309bcadd2e8847c8ee73

repl: use _Node.js_ in user-facing REPL text We use _node (REPL)_ in one place and _Node.js (REPL)_ in another place in error messages in repl.js. Use _Node.js_ in both places. PR-URL: https://github.com/nodejs/node/pull/34644 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>

view details

push time in a day

push eventnodejs/node

Robey Pointer

commit sha c0be31f0efd162f0edd416ed23f5aac082edd2aa

net: don't return the stream object from onStreamRead CallJSOnreadMethod expects the return value to be undefined or a new buffer, so make sure to return nothing, even when an error causes us to destroy the stream. Fixes: https://github.com/nodejs/node/issues/34346 PR-URL: https://github.com/nodejs/node/pull/34375 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

view details

push time in a day

PR closed nodejs/node

net/streams: don't return the stream object from onStreamRead author ready net stream

CallJSOnreadMethod expects the return value to be undefined or a new buffer, so make sure to return nothing, even when an error causes us to destroy the stream.

Fixes: https://github.com/nodejs/node/issues/34346

Checklist
  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
    • (except test-benchmark-napi, which has been broken since I cloned)
  • [x] commit message follows commit guidelines
+8 -3

29 comments

1 changed file

robey

pr closed time in a day

issue closednodejs/node

crash in node_buffer.cc on ECONNRESET when using net.Socket onread

  • Version: 14.4.0
  • Platform: Linux 4.19
  • Subsystem: net

occasionally, we see nodejs 14.4.0 drop core with a message like:

E 2020-07-01T21:38:27.737670958Z node[1]: ../src/node_buffer.cc:242:char* node::Buffer::Data(v8::Local<v8::Value>): Assertion `val->IsArrayBufferView()' failed.
I 2020-07-01T21:38:27.737769249Z [20200701-21:38:27.737] TRA conclave-5c84d47bd8-5b4pj (03e741ad-68e6-4f01-939c-922b53fb6004) @52: Socket error: read ECONNRESET
E 2020-07-01T21:38:27.738570272Z  1: 0xa2b020 node::Abort() [node]
E 2020-07-01T21:38:27.739024375Z  2: 0xa2b09e  [node]
E 2020-07-01T21:38:27.739592654Z  3: 0xa037aa node::Buffer::Data(v8::Local<v8::Value>) [node]
E 2020-07-01T21:38:27.740180478Z  4: 0xaf6481 node::CustomBufferJSListener::OnStreamRead(long, uv_buf_t const&) [node]
E 2020-07-01T21:38:27.740705062Z  5: 0xb02058 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [node]
E 2020-07-01T21:38:27.741487768Z  6: 0x132fb41  [node]
E 2020-07-01T21:38:27.742341825Z  7: 0x1330310  [node]
E 2020-07-01T21:38:27.743122216Z  8: 0x1336c50  [node]
E 2020-07-01T21:38:27.743991594Z  9: 0x13250f8 uv_run [node]
E 2020-07-01T21:38:27.744573560Z 10: 0xa6b9b4 node::NodeMainInstance::Run() [node]
E 2020-07-01T21:38:27.745148797Z 11: 0x9fae81 node::Start(int, char**) [node]
E 2020-07-01T21:38:27.745172061Z 12: 0x7f290cdd22e1 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
E 2020-07-01T21:38:27.745732198Z 13: 0x99529c  [node]

it seems to be always the same location, and always in response to an ECONNRESET on the socket. it only happens when using the "onread" hook in net.Socket.

the good news: after some trial & error, and digging through the nodejs code, i think i figured out why:

when we set "onread", the Socket init sets kBuffer and kBufferCb (net.js:306). then initSocketHandle will call useUserBuffer on the handle (net.js:254). this sets the uv listener to be a CustomBufferJSListener (stream_base.cc:59). so far so good.

when new data arrives, OnStreamRead calls CallJSOnreadMethod (stream_base.cc:535). if the JS method returns a value, it's assumed to be a new buffer to use next time.

the JS method is onStreamRead (stream_base_commons.js:163). if we got data, it returns nothing, unless kBufferGen is set, in which case it fetches a new buffer and returns that. cool.

if we got a non-EOF error, it instead destroys the socket and returns (line 205). unfortunately it uses a shortcut and returns whatever value destroy returns. destroy (destroy.js:5) always returns this. so the Socket gets returned and treated as a new buffer until it fails the assertion in Buffer::Data and crashes.

i think the easiest fix for this is to replace net.js line 205 to not return the socket:

    stream.destroy(errnoException(nread, 'read'));
    return;

i tested this by monkey-patching the socket destroy function to return nothing:

    const old_destroy = socket.destroy;
    socket.destroy = function (...args) { old_destroy.apply(this, args); };

this has been running for 6 days now without a crash, so i think it proves the fix.

closed time in a day

robey

pull request commentnodejs/node

net/streams: don't return the stream object from onStreamRead

Landed in c0be31f0efd162f0edd416ed23f5aac082edd2aa, and sorry for the delay!

robey

comment created time in a day

push eventnodejs/node

Myles Borins

commit sha 62bb2e757fc3e0074ef62aa4ca75f07f0519ef38

module: unflag Top-Level Await This unflags Top-Level await so it can be used by default in the module goal. This is accomplished by manually setting the --harmony-top-level-await flag. We are allowing this as a one of approval based on circumstances. It is not a precedent that future harmony features will be manually enabled. Refs: https://github.com/nodejs/node/issues/34551 PR-URL: https://github.com/nodejs/node/pull/34558 Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>

view details

Anna Henningsen

commit sha 35ef9907aa022b0f708c6f0f719ce0187b8ffb55

module: handle Top-Level Await non-fulfills better Handle situations in which the main `Promise` from a TLA module is not fulfilled better: - When not resolving the `Promise` at all, set a non-zero exit code (unless another one has been requested explicitly) to distinguish the result from a successful completion. - When rejecting the `Promise`, always treat it like an uncaught exception. In particular, this also ensures a non-zero exit code. Refs: https://github.com/nodejs/node/pull/34558 PR-URL: https://github.com/nodejs/node/pull/34640 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>

view details

push time in a day

delete branch addaleax/node

delete branch : esm-tla-fixes

delete time in a day

PR closed nodejs/node

module: handle Top-Level Await non-fulfills better ES Modules author ready dont-land-on-v12.x process

Handle situations in which the main Promise from a TLA module is not fulfilled better:

  • When not resolving the Promise at all, set a non-zero exit code (unless another one has been requested explicitly) to distinguish the result from a successful completion.
  • When rejecting the Promise, always treat it like an uncaught exception. In particular, this also ensures a non-zero exit code.

Refs: https://github.com/nodejs/node/pull/34558


I’m sorry, this is a bit late. I’ve added the dont-land label on #34558 – I remember these points being brought up before in discussion (not sure where), but it seems like they weren’t revisited before unflagging TLA on master. I personally think they need to be addressed before we actually ship this, and in particular silently treating await unresolved or await rejected as a success is not acceptable.

@mylesborins @nodejs/modules-active-members

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [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

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+111 -14

6 comments

8 changed files

addaleax

pr closed time in a day

pull request commentnodejs/node

module: handle Top-Level Await non-fulfills better

Landed in e948ef351b4111d78ae8ba08f29eb138af22fa0b

addaleax

comment created time in a day

push eventnodejs/node

Anna Henningsen

commit sha e948ef351b4111d78ae8ba08f29eb138af22fa0b

module: handle Top-Level Await non-fulfills better Handle situations in which the main `Promise` from a TLA module is not fulfilled better: - When not resolving the `Promise` at all, set a non-zero exit code (unless another one has been requested explicitly) to distinguish the result from a successful completion. - When rejecting the `Promise`, always treat it like an uncaught exception. In particular, this also ensures a non-zero exit code. Refs: https://github.com/nodejs/node/pull/34558 PR-URL: https://github.com/nodejs/node/pull/34640 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>

view details

push time in a day

push eventaddaleax/node

Anna Henningsen

commit sha 37e4ec2a13386b5115ebce9bc9ea66c58c44e930

fixup! test: add vm crash regression test

view details

push time in 2 days

PR opened nodejs/node

deps: V8: cherry-pick e06ace6b5cdb V8 Engine lts-watch-v10.x lts-watch-v12.x vm
deps: V8: cherry-pick e06ace6b5cdb

Original commit message:

[api] Fix empty Maybe crash in GetRealNamedPropertyAttributes

`Object::GetRealNamedPropertyAttributes()` can crash if an empty
`Maybe` is returned by `JSReceiver::GetPropertyAttributes()` because
it was not checking for that. Fix that.

Refs: https://github.com/nodejs/node/issues/34606
Change-Id: Ic83f904ba7134786bcd8f786eb2ce98adb4fea1e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335057
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69258}

Refs: https://github.com/v8/v8/commit/e06ace6b5cdb64b6abfe8e1229f2159b7a38b4e7

test: add vm crash regression test

Fixes: https://github.com/nodejs/node/issues/34606

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+65 -6

0 comment

4 changed files

pr created time in 2 days

create barnchaddaleax/node

branch : fix-34606

created branch time in 2 days

push eventaddaleax/node

Anna Henningsen

commit sha 7ff8795f850d6d73e3f9a68c8bfb2a5c7bda5a97

src: fix `size` underflow in CallbackQueue Only decrease the size when actually removing items.

view details

Anna Henningsen

commit sha 60941d60650e2707cff5c995a2e81bdc1b7ac59a

src: spin shutdown loop while immediates are pending This allows using `SetImmediate()` and friends at any point during cleanup.

view details

Anna Henningsen

commit sha b94ceaf88d9c6662fc53f7991c967203c5007d85

n-api: fix use-after-free with napi_remove_async_cleanup_hook Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572

view details

push time in 2 days

pull request commentnodejs/node

net: introduce net.BlockList

@jasnell No, and it’s odd that it’s only failing on ARM… that might be a V8 bug?

jasnell

comment created time in 2 days

create barnchaddaleax/node

branch : fix-napi-async-cleanup-uaf

created branch time in 3 days

PR opened nodejs/node

n-api: fix use-after-free with napi_remove_async_cleanup_hook

Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] commit message follows commit guidelines

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+6 -0

0 comment

1 changed file

pr created time in 3 days

Pull request review commentnodejs/node

crypto: add randomInt function

 threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. +### `crypto.randomInt([min, ]max[, callback])`+<!-- YAML+added:+  - REPLACEME+-->++* `min` {integer} Start of random range (inclusive). **Default**: `0`.+* `max` {integer} End of random range (inclusive).

I don’t think using a default like that would be helpful in most situations

olalonde

comment created time in 3 days

Pull request review commentnodejs/node

crypto: add randomInt function

 threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. +### `crypto.randomInt([min, ]max[, callback])`+<!-- YAML+added:+  - REPLACEME

@jasnell The previous entry was perfectly fine – I assume this was intentional, we do follow this format for cases in which semver-minor PRs get backported so that we can list multiple versions

olalonde

comment created time in 3 days

pull request commentnodejs/node

tools: fix C++ import checker argument expansion

I can do a manual backport

addaleax

comment created time in 3 days

push eventaddaleax/node

Anna Henningsen

commit sha 57be4cd1f40323da538c8b05a445ce1acd48b91c

fixup! src: fix linter failures

view details

push time in 3 days

pull request commentnodejs/node

async_hooks: avoid GC tracking of AsyncResource in ALS

This seems like it should be fairly uncontroversial, :+1: to fast-tracking?

Flarna

comment created time in 3 days

issue commentnodejs/node

Should EventEmitter extend AsyncResource?

To be blunt, I don’t think we can get any kind of reasonable async tracking for event emitters that isn’t implemented by the built-in EventEmitter class itself, there’s just too much code written out there that doesn’t expect this. AsyncResource.bind or a possible asyncResource option to the EventEmitter constructor (which probably wouldn’t even give us the right thing!) are nice but just not practical as actual solutions in the bigger picture here.

And I know it’s not great to go and decrease EE performance, but if we end up recommending everybody to do the changes on the consumer side, the only difference is the massive amount of work that needs to be done in the ecosystem.

ronag

comment created time in 3 days

delete branch addaleax/node

delete branch : async-cleanup-hook

delete time in 3 days

push eventnodejs/node

Anna Henningsen

commit sha 22cbbcf9d9374d4b663bf1409f292212fa57623a

n-api,src: provide asynchronous cleanup hooks Sometimes addons need to perform cleanup actions, for example closing libuv handles or waiting for requests to finish, that cannot be performed synchronously. Add C++ API and N-API functions that allow providing such asynchronous cleanup hooks. Fixes: https://github.com/nodejs/node/issues/34567 PR-URL: https://github.com/nodejs/node/pull/34572 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>

view details

push time in 3 days

issue closednodejs/node

Worker thread aborts on terminate if native node module has an open async handle

  • Version: v14.6.0, v12.14.1
  • Platform: 4.15.0-1091-oem #101-Ubuntu SMP Thu Jun 25 17:55:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: worker_threads

What steps will reproduce the bug?

I have opened up a repository here that can be used to reliably crash node. Follow the steps in README.md to replicate.

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

This reproduces so long as a native node module has an active async handle for async completion.

What is the expected behavior?

Worker thread should not terminate until all handles are cleaned up. Modules should be able to exit gracefully when terminate is requested.

npm test

> native-node-tests@1.0.0 test /home/tylerw/github/test/native-node-tests
> node -e "w = new (require('worker_threads').Worker)('./runDoAsyncThing.js'); setTimeout(w.terminate.bind(w), 2000);"

Entering execute thread

What do you see instead?

npm test

> native-node-tests@1.0.0 test /home/tylerw/github/test/native-node-tests
> node -e "w = new (require('worker_threads').Worker)('./runDoAsyncThing.js'); setTimeout(w.terminate.bind(w), 2000);"

Entering execute thread
uv loop at [0x7f18151e1ad8] has open handles:
uv loop at [0x7f18151e1ad8] has 0 open handles in total
node[23076]: ../src/debug_utils.cc:322:void node::CheckedUvLoopClose(uv_loop_t*): Assertion `0 && "uv_loop_close() while having open handles"' failed.
 1: 0x9fb000 node::Abort() [node]
 2: 0x9fb07e  [node]
 3: 0x98e9f1  [node]
 4: 0xab2e44 node::worker::Worker::Run() [node]
 5: 0xab2e88  [node]
 6: 0x7f1817de06db  [/lib/x86_64-linux-gnu/libpthread.so.0]
 7: 0x7f1817b09a3f clone [/lib/x86_64-linux-gnu/libc.so.6]
Aborted (core dumped)
npm ERR! Test failed.  See above for more details.

closed time in 3 days

implausible

PR closed nodejs/node

n-api,src: provide asynchronous cleanup hooks C++ addons author ready lib / src n-api semver-minor

Sometimes addons need to perform cleanup actions, for example closing libuv handles or waiting for requests to finish, that cannot be performed synchronously.

Add C++ API and N-API functions that allow providing such asynchronous cleanup hooks.

Fixes: https://github.com/nodejs/node/issues/34567

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

@nodejs/n-api

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [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

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+368 -3

4 comments

13 changed files

addaleax

pr closed time in 3 days

pull request commentnodejs/node

n-api,src: provide asynchronous cleanup hooks

Landed in 22cbbcf9d9374d4b663bf1409f292212fa57623a

addaleax

comment created time in 3 days

Pull request review commentnodejs/node

src: set SA_SIGINFO flag when using sa_sigaction

 void RegisterSignalHandler(int signal,   struct sigaction sa;   memset(&sa, 0, sizeof(sa));   sa.sa_sigaction = handler;-  sa.sa_flags = reset_handler ? SA_RESETHAND : 0;+  sa.sa_flags = reset_handler ? SA_RESETHAND : SA_SIGINFO;

SA_SIGINFO should always be set, regardless of reset_handler, right?

richardlau

comment created time in 3 days

Pull request review commentnodejs/node

crypto: add randomInt function

 function randomFill(buf, offset, size, cb) {   _randomBytes(buf, offset, size, wrap); } +// Largest integer we can read from a buffer.+// e.g.: Buffer.from("ff".repeat(6), "hex").readUIntBE(0, 6);+const RAND_MAX = 281474976710655;++// Generates an integer in [min, max] range where both min and max are+// inclusive.+function randomInt(min, max, cb) {+  // randomInt(max, cb)+  // randomInt(max)+  if (typeof max === 'function' || typeof max === 'undefined') {+    cb = max;+    max = min;+    min = 0;+  }+  const isSync = typeof cb === 'undefined';+  if (!isSync && typeof cb !== 'function') {+    throw new ERR_INVALID_CALLBACK(cb);+  }+  if (!NumberIsSafeInteger(min)) {+    throw new ERR_INVALID_ARG_TYPE('min', 'safe integer', min);+  }+  if (!NumberIsSafeInteger(max)) {+    throw new ERR_INVALID_ARG_TYPE('max', 'safe integer', max);+  }+  if (!(max > min)) {+    throw new ERR_OUT_OF_RANGE('max', `> ${min}`, max);
  if (!(max >= min)) {
    throw new ERR_OUT_OF_RANGE('max', `>= ${min}`, max);

Since the ranges are inclusive now? It doesn’t make a lot of sense to explicitly specify two equal values at first sight, but the logical bound to require here is max >= min, not max > min

olalonde

comment created time in 3 days

Pull request review commentnodejs/node

crypto: add randomInt function

 threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. +### `crypto.randomInt([min, ]max[, callback])`+<!-- YAML+added:+  - CHANGEME
  - REPLACEME

(see the earlier comment – REPLACEME is a special string, other values will not be picked up during the release process)

olalonde

comment created time in 3 days

Pull request review commentnodejs/node

crypto: add randomInt function

 function randomFill(buf, offset, size, cb) {   _randomBytes(buf, offset, size, wrap); } +// Largest integer we can read from a buffer.+// e.g.: Buffer.from("ff".repeat(6), "hex").readUIntBE(0, 6);+const RAND_MAX = 281474976710655;++// Generates an integer in [min, max] range where both min and max are+// inclusive.+function randomInt(min, max, cb) {+  // randomInt(max, cb)+  // randomInt(max)+  if (typeof max === 'function' || typeof max === 'undefined') {+    cb = max;+    max = min;+    min = 0;+  }+  const isSync = typeof cb === 'undefined';+  if (!isSync && typeof cb !== 'function') {+    throw new ERR_INVALID_CALLBACK(cb);+  }+  if (!NumberIsSafeInteger(min)) {+    throw new ERR_INVALID_ARG_TYPE('min', 'safe integer', min);+  }+  if (!NumberIsSafeInteger(max)) {+    throw new ERR_INVALID_ARG_TYPE('max', 'safe integer', max);+  }+  if (!(max > min)) {+    throw new ERR_OUT_OF_RANGE('max', `> ${min}`, max);+  }++  // First we generate a random int between [0..range]+  const range = max - min + 1;++  if (!(range <= RAND_MAX)) {+    throw new ERR_OUT_OF_RANGE('max - min', `<= ${RAND_MAX}`, range);
    throw new ERR_OUT_OF_RANGE('max - min', `< ${RAND_MAX}`, range);
olalonde

comment created time in 3 days

issue commentnodejs/node

Array.sort arguments order changed in Node.js 11

@JJBocanegra As @devsnek said, this is a bug in your code. It’s not really related to this issue here.

hudochenkov

comment created time in 3 days

issue commentnodejs/node

Array.sort arguments order changed in Node.js 11

@JJBocanegra Can you open a new issue at https://github.com/nodejs/help/issues/ instead of discussing this one?

hudochenkov

comment created time in 3 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

I don’t think most people would know what “ESM Import Stalled” means.

Again, I think this is mostly relevant when you’re actually developing a loader or similar, and in that case you most likely don’t even need any explanation at all.

addaleax

comment created time in 3 days

push eventnodejs/nan

John Kerl

commit sha 8e4603d00fcbb5069b04da1368939d885163e2ce

c++ -> C++ in README.md (#897)

view details

push time in 3 days

PR merged nodejs/nan

c++ -> C++ in README.md

Only that :)

+1 -1

0 comment

1 changed file

johnkerl

pr closed time in 3 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

To be clear, I consider any kind of failure to finish the main module’s evaluation, whether through TLA or not, something that should not be considered a successful operation. This is intentional, and I would be against restricting the check here to only module.evaluate().

addaleax

comment created time in 3 days

push eventaddaleax/node

Anna Henningsen

commit sha 9b3aa518d030736c9b7528f24e8ce8cf86512647

fixup! fixup! module: handle Top-Level Await non-fulfills better

view details

push time in 4 days

push eventaddaleax/node

Anna Henningsen

commit sha 2fb08db29b69788e63c643ab3120e8f38f855f0e

fixup! fixup! module: handle Top-Level Await non-fulfills better

view details

push time in 4 days

push eventaddaleax/node

Anna Henningsen

commit sha 520196069f99555c8748ef7e49df37f6f6c586cf

fixup! module: handle Top-Level Await non-fulfills better

view details

push time in 4 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 function runMainESM(mainPath) {   esmLoader.loadESM((ESMLoader) => {

Hm … for some reason I thought I saw an UnhandledRejectionWarning from TLA when trying it out, but you should be right, yes. Not sure what’s up with that, but I’ve updated it to keep using that :+1:

addaleax

comment created time in 4 days

Pull request review commentnodejs/node

module: handle Top-Level Await non-fulfills better

 cases:   and generally can only happen during development of Node.js itself. * `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk`   options were set, but the port number chosen was invalid or unavailable.+* `13` **Unfinished Top-Level Await**: `await` was used outside of a function

Are you suggesting to explicitly list that special case? I would prefer not to, if you’re working on an ESM loader then you can probably imagine that import() stalling would look like unfinished TLA. The far more common case is going to be actual TLA usage, I assume

addaleax

comment created time in 4 days

pull request commentnodejs/node

module: unflag Top-Level Await

@codebytere I don’t know – is there a practical difference? The next step would be to just remove the label again once #34640 lands, regardless of which one is used, right? Anyway, feel free to put the correct one here if I got it wrong. :)

MylesBorins

comment created time in 4 days

pull request commentnodejs/node

module: unflag Top-Level Await

Just so the context is here as well, I’ve added dont-land-on-v14.x because I think that this should not be released without #34640, and dont-land-on-v12.x because my understanding is that it wouldn’t apply there.

MylesBorins

comment created time in 4 days

pull request commentnodejs/node

module: handle Top-Level Await non-fulfills better

@MylesBorins In my very subjective opinion, this PR would bring things where they need to be. ;)

addaleax

comment created time in 4 days

PR opened nodejs/node

module: handle Top-Level Await non-fulfills better

Handle situations in which the main Promise from a TLA module is not fulfilled better:

  • When not resolving the Promise at all, set a non-zero exit code (unless another one has been requested explicitly) to distinguish the result from a successful completion.
  • When rejecting the Promise, always treat it like an uncaught exception. In particular, this also ensures a non-zero exit code.

Refs: https://github.com/nodejs/node/pull/34558


I’m sorry, this is a bit late. I’ve added the dont-land label on #34558 – I remember these points being brought up before in discussion (not sure where), but it seems like they weren’t revisited before unflagging TLA on master. I personally think they need to be addressed before we actually ship this, and in particular silently treating await unresolved or await rejected as a success is not acceptable.

@mylesborins @nodejs/modules-active-members

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md -->

Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

  • [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

<!-- Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

+120 -17

0 comment

11 changed files

pr created time in 4 days

create barnchaddaleax/node

branch : esm-tla-fixes

created branch time in 4 days

pull request commentDefinitelyTyped/DefinitelyTyped

[node] Update with changes from v14.6.0

@simonschick I’m not sure I’ll have time for finishing that task up this week.

So can you pick either one of your review comments? You’ve asked me to bump the version, and subsequently asked me to bump the code so that it matches that version; that basically leaves me with no option but a massive scope creep for this PR. I don’t think that’s a helpful review process, and I would appreciate it if you were to pick one (update the version or not, but not expect me to do a ton of extra work).

addaleax

comment created time in 4 days

Pull request review commentnodejs/node

doc: harden policy around objections

 needed [approvals](#code-reviews), [CI](#testing-and-ci), and except the [wait time](#waiting-for-approvals), please add the [`author ready`](#author-ready-pull-requests) label. -Where there is disagreement among Collaborators, consensus should be sought if-possible. If reaching consensus is not possible, a Collaborator may escalate the-issue to the TSC.--Collaborators should not block a pull request without providing a reason.-Another Collaborator may ask an objecting Collaborator to explain their-objection. If the objector is unresponsive, another Collaborator may dismiss the-objection.+If a collaborator believes a pull request should not land as is, **the "Reuqest+Changes" GitHub feature must be used to make the objection explicit**. An+implicit objection not using the "Request Changes" feature is not considered a+blocker for a  pull requests. Pull requests with an explicit objection should+not land until all objections are satisfied. Collaborators should not block a+pull request without providing a reason. **Providing a set of actionable steps+alongside the objection is recommended, and the objector must be willing to+work with the pull request author to reach a consensus about the direction of+the pull reuqest**. If reaching consensus is not possible, a Collaborator may
the pull request**. If reaching consensus is not possible, a Collaborator may
mmarchini

comment created time in 4 days

Pull request review commentnodejs/node

module: custom --conditions flag option

 $ node --completion-bash > node_bash_completion $ source node_bash_completion ``` +### `-u`, `--conditions=conditionA,conditionB`

Our options parser natively supports passing an option multiple times, e.g. -u condA -u condB or --conditions condA --conditions=condB. Using that tends to be a bit nicer, because it means that one piece of code (in a tool that spawns a Node.js process) can set a flag without worrying about whether another piece of code has set the same flag already.

Specifying the type of the option variable as std::vector<std::string> instead of a plain std::string is sufficient for that.

(In that case it might make sense to name the option --condition, i.e. singular)

guybedford

comment created time in 4 days

issue commentnodejs/node

node 12.18.3 fails with TypeError: cb.apply is not a function in graceful-fs

@iamstarkov Right, but graceful-fs (which is not just a dependency of npm, it’s actually shipped as part of the npm package) depends on Node.js internals in a way that does not follow semver. In particular, in this case, we started using a custom option for a file system operation inside of Node.js itself, and the monkey-patched fs module from graceful-fs did not recognize that option in earlier versions.

milprog

comment created time in 4 days

issue commentnode-ffi-napi/ref-napi

It seems the writeCString may write over the end of buffer

Done in v2.0.4!

wjzhou

comment created time in 4 days

issue closednodejs/node

`weak-napi` broken in Node 14.7.0 (working in 14.6.0)

<!-- Thank you for reporting an issue.

This issue tracker is for bugs and issues found within Node.js core. If you require more general support please file an issue on our help repo. https://github.com/nodejs/help

Please fill in as much of the template below as you're able.

Version: output of node -v Platform: output of uname -a (UNIX), or version and 32 or 64-bit (Windows) Subsystem: if known, please specify affected core module name -->

  • Version: 14.7.0
  • Platform: Darwin Simens-MacBook-Pro.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 18 20:50:10 PDT 2020; root:xnu-4903.278.43~1/RELEASE_X86_64 x86_64
  • Subsystem: N-API (I think)

What steps will reproduce the bug?

Clone https://github.com/node-ffi-napi/weak-napi, run install and run the tests. They fail on node 14.7.0, but pass on node 14.6.0.

I discovered this via Jest's tests failing (which use weak-napi). I assume Jest's --detect-leaks feature is broken for this version of Node.

(weak-napi could probably be added to CITGM)

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

It always fails

What is the expected behavior?

Tests should pass 🙂

<!-- If possible please provide textual output instead of screenshots. -->

What do you see instead?

Tests fail 🙁

<!-- If possible please provide textual output instead of screenshots. -->

Additional information

I haven't bisected, but #34386 seems like the obvious candidate looking at the changelog

/cc @addaleax

<!-- Tell us anything else you think we should know. -->

closed time in 4 days

SimenB

issue commentnodejs/node

`weak-napi` broken in Node 14.7.0 (working in 14.6.0)

Yeah, unless this is causing any trouble besides the timing difference, I think there’s nothing actionable here. Let us know if we should reopen :)

SimenB

comment created time in 4 days

created tagnode-ffi-napi/ref-napi

tagv2.0.4

Turn Buffer instances into "pointers"

created time in 4 days

push eventnode-ffi-napi/ref-napi

Anna Henningsen

commit sha 0b6bbb3d81da631c7cad20a8169f026d670425bc

Adjust tests for timing differences on Node 14.7+ Refs: https://github.com/nodejs/node/issues/34636 Refs: https://github.com/nodejs/node/pull/34386

view details

Anna Henningsen

commit sha 0d8234e38e0502c1bb0a074efb3fa15174e11aa6

Do not attempt to perform OOB write in writeCString Include the nul terminator in the size computation. Otherwise, Node.js may throw an exception when `.writeUInt8` is called. Fixes: https://github.com/node-ffi-napi/ref-napi/issues/40

view details

Anna Henningsen

commit sha 9b58c254c1b0fecb160e661971753cbe27330fac

v2.0.4

view details

push time in 4 days

issue closednode-ffi-napi/ref-napi

It seems the writeCString may write over the end of buffer

I'm trying to debug a crash of my application. (Not isolated yet)

When reading the source code, it seems the following function may write over the end of buffer, did I miss anything?

L582 may return a len = size which equal to buffer.length-offset. so at L583, offset+len equal offset+buffer.length-offset = buffer.length

Shouldn't the L581 be const size = buffer.length - offset-1?

https://github.com/node-ffi-napi/ref-napi/blob/7d0d7b24d242372c7557d571cbe2a87ef67ac53d/lib/ref.js#L572-L584

closed time in 4 days

wjzhou

issue commentnode-ffi-napi/ref-napi

It seems the writeCString may write over the end of buffer

Fwiw, the line in question does not actually perform an OOB write; it throws an exception if offset+len is OOB, so it’s probably not the cause of the crash you were seeing.

wjzhou

comment created time in 4 days

issue commentnode-ffi-napi/ref-napi

It seems the writeCString may write over the end of buffer

Thanks for pointing this out! Yes, this looks like a bug. I’ll publish a new release shortly.

wjzhou

comment created time in 4 days

issue commentnodejs/node

`weak-napi` broken in Node 14.7.0 (working in 14.6.0)

@simenb There isn’t really any strong guarantee, partly because V8 itself also doesn’t give us any strong guarantees. 2 × setImmediate is currently enough, so you can pick 10 or so if you want to be reasonably safe (that is, as long as setImmediate() works at all).

SimenB

comment created time in 4 days

issue commentnodejs/node

`weak-napi` broken in Node 14.7.0 (working in 14.6.0)

I haven't bisected, but #34386 seems like the obvious candidate looking at the changelog

I’ve confirmed that reverting it fixes the weak-napi test suite, yes.

(weak-napi could probably be added to CITGM)

@nodejs/citgm I’d be :+1: on this.


That being said, I don’t think the weak-napi breakage qualifies as a bug in Node.js or N-API. The weak-napi tests are/were simply expecting stricter relative timing guarantees than what Node.js provides, and fixing the tests up (node-ffi-napi/weak-napi@fdafbdefcfe1a418ddae0cca36974a401f4ec7ef) seems like the right thing to do here, at least with my N-API and weak-napi maintainer hat on.

SimenB

comment created time in 4 days

push eventnode-ffi-napi/weak-napi

Anna Henningsen

commit sha fdafbdefcfe1a418ddae0cca36974a401f4ec7ef

Adjust tests for timing differences on Node 14.7+ Refs: https://github.com/nodejs/node/issues/34636 Refs: https://github.com/nodejs/node/pull/34386

view details

push time in 4 days

issue commentnodejs/node

node 12.18.3 fails with TypeError: cb.apply is not a function in graceful-fs

@iamstarkov The problem is the semantic-release@16.0.0-beta.18 (hardcoded in your package.json, no semver range) → @semantic-release/npm@^5.2.0-beta.5npm@6.5.0 (also hardcoded, no semver range) dependency chain. Simply upgrading your dependencies should be enough. You may not want to rely on beta versions of tools anyway.

milprog

comment created time in 4 days

issue commentnodejs/node

Node fatal error: ToggleAsyncHook Cannot toggle Inspector's AsyncHook

@0ams Yes, this should also be part of the next v12.x release, I think.

edopalmieri

comment created time in 4 days

Pull request review commentnodejs/node

net: introduce net.BlockList

 class SocketAddress : public MemoryRetainer {   sockaddr_storage address_; }; +// A BlockList is used to evaluate whether a given+// SocketAddress should be accepted for inbound or+// outbound network activity.+class SocketAddressBlockList {+ public:+  SocketAddressBlockList() = default;+  ~SocketAddressBlockList() = default;++  void AddSocketAddress(+      const SocketAddress& address);++  void AddSocketAddressRange(+      const SocketAddress& start,+      const SocketAddress& end);++  void AddSocketAddressMask(+      const SocketAddress& address,+      int prefix);++  bool Apply(const SocketAddress& address);++  size_t size() const { return rules_.size(); }++  struct Rule {+    virtual bool Apply(const SocketAddress& address) = 0;+  };++  struct SocketAddressRule : Rule {+    SocketAddress address;++    SocketAddressRule(const SocketAddress& address);++    bool Apply(const SocketAddress& address) override;+  };++  struct SocketAddressRangeRule : Rule {+    SocketAddress start;+    SocketAddress end;++    SocketAddressRangeRule(+        const SocketAddress& start,+        const SocketAddress& end);++    bool Apply(const SocketAddress& address) override;+  };++  struct SocketAddressMaskRule : Rule {

final for all of these?

jasnell

comment created time in 4 days

Pull request review commentnodejs/node

net: introduce net.BlockList

 class SocketAddress : public MemoryRetainer {   sockaddr_storage address_; }; +// A BlockList is used to evaluate whether a given+// SocketAddress should be accepted for inbound or+// outbound network activity.+class SocketAddressBlockList {+ public:+  SocketAddressBlockList() = default;+  ~SocketAddressBlockList() = default;++  void AddSocketAddress(+      const SocketAddress& address);++  void AddSocketAddressRange(+      const SocketAddress& start,+      const SocketAddress& end);++  void AddSocketAddressMask(+      const SocketAddress& address,+      int prefix);++  bool Apply(const SocketAddress& address);++  size_t size() const { return rules_.size(); }++  struct Rule {+    virtual bool Apply(const SocketAddress& address) = 0;+  };++  struct SocketAddressRule : Rule {+    SocketAddress address;++    SocketAddressRule(const SocketAddress& address);++    bool Apply(const SocketAddress& address) override;+  };++  struct SocketAddressRangeRule : Rule {+    SocketAddress start;+    SocketAddress end;++    SocketAddressRangeRule(+        const SocketAddress& start,+        const SocketAddress& end);++    bool Apply(const SocketAddress& address) override;+  };++  struct SocketAddressMaskRule : Rule {+    SocketAddress address;+    int prefix;++    SocketAddressMaskRule(+        const SocketAddress& address,+        int prefix);++    bool Apply(const SocketAddress& address) override;+  };++ private:+  std::list<std::unique_ptr<Rule>> rules_;+};++class SocketAddressBlockListWrap :+    public BaseObject,+    public SocketAddressBlockList {+ public:+  static void Initialize(v8::Local<v8::Object> target,+                         v8::Local<v8::Value> unused,+                         v8::Local<v8::Context> context,+                         void* priv);++  static void New(const v8::FunctionCallbackInfo<v8::Value>& args);+  static void AddAddress(const v8::FunctionCallbackInfo<v8::Value>& args);+  static void Check(const v8::FunctionCallbackInfo<v8::Value>& args);++  SocketAddressBlockListWrap(+      Environment* env,+      v8::Local<v8::Object> wrap);++  SET_NO_MEMORY_INFO()

This should report memory usage

jasnell

comment created time in 4 days

Pull request review commentnodejs/node

quic: rework socketaddress info tracking and other cleanups

 class SocketAddress : public MemoryRetainer {   sockaddr_storage address_; }; +template <typename T>+class SocketAddressLRU : public MemoryRetainer {+ public:+  using Type = typename T::Type;+  using Pair = std::pair<SocketAddress, Type>;+  using Iterator = typename std::list<Pair>::iterator;

These should go into the private: section as implementation details, imo?

jasnell

comment created time in 4 days

Pull request review commentlibuv/libuv

unix: handle src, dest same in uv_fs_copyfile()

 static ssize_t uv__fs_copyfile(uv_fs_t* req) {    dst_flags = O_WRONLY | O_CREAT | O_TRUNC;

Would it possibly make more sense to remove the O_TRUNC flag from here?

Wouldn't that break copy operations that overwrite existing files?

We could manually truncate using ftruncate() after fstat() on the already-opened fd, right?

cjihrig

comment created time in 4 days

Pull request review commentnodejs/node

test: replace flaky pummel regression tests

+// Flags: --expose-gc+'use strict';+const common = require('../common');+const tmpdir = require('../common/tmpdir');+const assert = require('assert');+const path = require('path');++// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/814:+// Make sure that Buffers passed to fs.write() are not garbage-collected+// even when the callback is being reused.++const fs = require('fs');++tmpdir.refresh();+const filename = path.join(tmpdir.path, 'test.txt');+const fd = fs.openSync(filename, 'w');++const size = 16 * 1024;+const writes = 1000;+let done = 0;++const ondone = common.mustCall((err) => {+  assert.ifError(err);+  if (++done < writes) {+    if (done % 25 === 0) global.gc();+    setImmediate(write);+  } else {+    assert.strictEqual(+      fs.readFileSync(filename, 'utf8'),+      'x'.repeat(writes * size));+    fs.closeSync(fd);+  }+}, writes);++write();+function write() {+  const buf = Buffer.alloc(size, 'x');+  fs.write(fd, buf, 0, buf.size, -1, ondone);

@gengjiawen Sorry, yes – do you want to open a PR to fix this?

addaleax

comment created time in 5 days

Pull request review commentnodejs/node

crypto: add randomInt function

 function randomFill(buf, offset, size, cb) {   _randomBytes(buf, offset, size, wrap); } +// Largest integer we can read from a buffer.+// e.g.: Buffer.from("ff".repeat(6), "hex").readUIntBE(0, 6);+const RAND_MAX = 281474976710655;++function randomInt(min, max, cb) {

Tbh, I’d personally prefer consistency with randomBytes(). We can totally add crypto.promises like we did with fs/dns.

olalonde

comment created time in 6 days

issue commentnodejs/help

Startup time issue on ARM

Perhaps an inbuilt snapshot is used to speed up initialization? (Yocto configures Node with --without-snapshot..

That sounds like a likely candidate, yes.

stewy

comment created time in 6 days

push eventaddaleax/node

Anna Henningsen

commit sha 00ab6d84be6b421a52b7af73f9d7ab4c7d20627d

fixup! fixup! n-api,src: provide asynchronous cleanup hooks

view details

push time in 6 days

Pull request review commentnodejs/node

n-api,src: provide asynchronous cleanup hooks

+#define NAPI_EXPERIMENTAL

@gabrielschulhof I’ve converted this to a C file.

However, I would strongly encourage you to address this yourself for other tests instead of expecting people to do the work as part of the PR review process. It’s generally not a great situation for contributors if you can’t base a new test off existing tests.

addaleax

comment created time in 6 days

push eventaddaleax/node

Anna Henningsen

commit sha e658a9f92ded577a52514c301d866bac353d606e

fixup! n-api,src: provide asynchronous cleanup hooks

view details

push time in 6 days

Pull request review commentnodejs/node

crypto: add randomInt function

 threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. +### `crypto.randomInt([min, ]max[, callback])`+<!-- YAML+added:+  - v14.8.0+-->++* `min` {integer} Start of random range. **Default**: `0`.+* `max` {integer} End of random range (non-inclusive).+* `callback` {Function} `function(err, n) {}`.++Return a random integer `n` such that `min <= n < max`.  This+implementation avoids [modulo+bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).++The maximum supported range value (`max - min`) is `2^48 - 1`.++If the `callback` function is not provided, the random integer is generated+synchronously.++```js+// Asynchronous+crypto.randomInt(3, (err, n) => {+  if (err) throw err;+  console.log(`Random number chosen from (0, 1, 2): ${n}`);+});+```++```js+// Synchronous+const n = crypto.randomInt(3);+console.log(`Random number chosen from (0, 1, 2): ${n}`);+```++```js+crypto.randomInt(1, 7, (err, n) => {

Fwiw, generally the terms “minimum” and “maximum” are considered to be inclusive. However, I don’t know of a good term for the upper bound that would be implicitly exclusive, so I hadn’t commented before here. start and end might be better, comparable to the behavior for e.g. array functions like .slice().

olalonde

comment created time in 6 days

issue commentnodejs/node

Crash at v8::Object::GetRealNamedPropertyAttributes

Opened https://chromium-review.googlesource.com/c/v8/v8/+/2335057 to address this in V8

po6ix

comment created time in 6 days

issue commentnodejs/node

Wrong behaviour of console.log in node 10

@iandrc That depends on the commit, e.g. whether it’s partially backportable or not. But probably leave it as-is, yes.

oscaretu

comment created time in 6 days

issue commentnodejs/node

Wrong behaviour of console.log in node 10

@iandrc Sure – just be prepared, I think this may be something that might intentionally have been changed as a semver-major commit (i.e. not backportable).

oscaretu

comment created time in 6 days

push eventaddaleax/node

Anna Henningsen

commit sha de6c455af758c102a163f6360673128a3f6158b0

fixup! tools: fix C++ import checker argument expansion Co-authored-by: Richard Lau <riclau@uk.ibm.com>

view details

push time in 6 days

more