100 Commits
Author SHA1 Message Date
Darshan Sen c63e88e9a6 inspector: support inspecting HTTP/2 request and response bodies
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60483
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-11-04 08:35:00 +00:00
Darshan Sen f46152fdb3 http2: add diagnostics channels for client stream request body
These would allow inspection of HTTP/2 client stream request bodies.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/60480
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2025-11-01 19:56:44 +05:30
Darshan Sen c86c488e18 inspector: add http2 tracking support
This allows tracking HTTP/2 calls through the Network tab of
Chrome DevTools for Node.js.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/59611
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
2025-08-27 16:25:13 +00:00
Darshan Sen 7f3a150388 http2: report sent headers object in client stream dcs
This change improves diagnosis by reporting the headers object that is
actually sent rather than the original input headers in the following
diagnostics channels:
- 'http2.client.stream.created'
- 'http2.client.stream.start'

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/59419
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-08-17 05:29:41 +00:00
Darshan Sen 751203d36b http2: set Http2Stream#sentHeaders for raw headers
When https://github.com/nodejs/node/pull/57917 added support for sending
raw header arrays, Http2Stream#sentHeaders was set only for header
objects. This change also sets it for raw headers by lazily
instantiating the property to avoid any performance impact on the fast
path.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/59244
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-07-29 14:44:52 +00:00
Darshan Sen cde8f275ad tools: allow selecting test subsystems with numbers in their names
Previously, selecting subsystems with numbers in their names, like
http2, weren't matched due to a restrictive regex:

```
$ tools/test.py http2
No tests to run.
```

The regex now allows digits, so these tests run as expected:

```
$ tools/test.py http2
[00:17|% 100|+ 286|-   0]: Done

All tests passed.
```

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/59242
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-07-29 13:24:35 +00:00
Darshan Sen 85e8cc6ff3 http2: add diagnostics channel 'http2.server.stream.close'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58602
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2025-06-11 11:57:51 +00:00
Darshan Sen b23648ef2e test: improve flakiness detection on stack corruption tests
This change skips asserting the exit code of the child process with the
corrupted async hooks stack only on those platforms where termination
via a signal has been observed.

Refs: https://github.com/nodejs/node/pull/58478#discussion_r2132170010
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58601
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-06-08 13:17:08 +00:00
Darshan Sen 641653b2da http2: add diagnostics channel 'http2.server.stream.finish'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58560
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-06-04 14:51:58 +00:00
Darshan Sen d89657c29e http2: add diagnostics channel 'http2.server.stream.error'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58512
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-06-01 13:08:20 +00:00
Darshan Sen a984ed388a doc: explain child_process code and signal null values everywhere
Refs: https://github.com/nodejs/node/issues/58463#issuecomment-2911460454
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58479
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-05-29 11:42:14 +00:00
Darshan Sen fd46569a50 http2: add diagnostics channel 'http2.server.stream.start'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58449
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2025-05-29 11:11:46 +00:00
Darshan Sen 7ce82ad1de test: account for truthy signal in flaky async_hooks tests
When the spawned child process gets closed with a signal, the exit code
is not set and that is why the exit code assertion was failing. This
change adjusts the test to check the signal and if it is truthy, it
doesn't assert the exit code and instead logs the signal and continues
the rest of the assertions.

Refs: https://github.com/nodejs/node/issues/58463#issuecomment-2911460454
Refs: https://github.com/nodejs/node/issues/58199
Refs: https://github.com/nodejs/node/issues/58463
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58478
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-05-29 07:40:11 +00:00
Darshan Sen c3b580d9f0 http2: add diagnostics channel 'http2.server.stream.created'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58390
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-05-25 13:22:05 +00:00
Darshan Sen 7c74205aa7 http2: add diagnostics channel 'http2.client.stream.close'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58329
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-05-19 08:12:41 +00:00
Darshan Sen 9eb9c26b26 net: always publish to 'net.client.socket' diagnostics channel
Previously, the 'net.client.socket' diagnostics channel was only
published to when `net.connect()` was called. This change ensures the
message is also published for the following calls:

- net.createConnection()
- net.Socket#connect()
- tls.connect()

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58349
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2025-05-18 09:05:17 +00:00
Darshan Sen ccf227eac8 http2: add diagnostics channel 'http2.client.stream.finish'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58317
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-05-18 13:04:59 +05:30
Darshan Sen 8053a5c1c7 http2: add diagnostics channel 'http2.client.stream.error'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58306
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2025-05-16 12:15:50 +00:00
Darshan Sen b1973550e0 http2: add diagnostics channel 'http2.client.stream.start'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58292
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2025-05-14 07:41:42 +00:00
Darshan Sen 5f841fb2c8 http2: add diagnostics channel 'http2.client.stream.created'
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58246
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2025-05-11 08:38:15 +00:00
Darshan Sen e2c8a0f9b8 doc: add back mention of visa fees to onboarding doc
Thanks to the incredible support from the community in
https://github.com/openjs-foundation/cross-project-council/issues/1240
we were able to amend the OpenJS Foundation travel fund policy to now
cover visa costs (even in case the visa is denied).

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57730
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Ruy Adorno <ruy@vlt.sh>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-04 14:28:42 +00:00
Darshan Sen 4c1b8760f6 doc: recommend watching the collaborators repo in the onboarding doc
It might be easy to miss this repo. For example, I forgot rewatching
this repo when I rejoined. So it would be a good idea to mention this in
the collaborator onboarding guide.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57527
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
2025-03-20 08:05:02 +00:00
Darshan Sen 7955a0f589 doc: remove mention of visa fees from onboarding doc
The note in
https://github.com/openjs-foundation/cross-project-council/blob/main/community-fund/COMMUNITY_FUND_POLICY.md#community-fund-rules
says that the funds may not be used for visa costs, so this change
corrects the doc.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57526
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2025-03-20 07:38:10 +00:00
Darshan Sen e162783843 doc: add history info for --use-system-ca
These are the PRs for --use-system-ca:
- initial implementation of the option with just macOS support
  https://github.com/nodejs/node/pull/56599 landed in v23.8.0.
- Windows support https://github.com/nodejs/node/pull/56833
  landed in v23.8.0
- non-Windows and non-macOS support
  https://github.com/nodejs/node/pull/57009 landed in v23.9.0

This change documents the history info.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57432
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2025-03-15 08:35:29 +00:00
Darshan Sen d765e70802 doc: remove typo YAML snippet from tls.getCACertificates doc
Noticed it while going through
https://github.com/nodejs/node/pull/57107/files#diff-6114e55c49ec9bc0edc33830f7770a335a46373a84b8372957c387d88a23b7deR2399,
so thought of removing it.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57459
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-03-15 05:29:54 +00:00
Darshan Sen 9325697379 meta: move RaisinTen back to collaborators, triagers and SEA champion
Refs: https://github.com/nodejs/TSC/issues/1690
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57292
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2025-03-07 14:52:43 +00:00
Darshan Sen b7ca80f1d4 meta: move RaisinTen to emeritus and remove from strategic initiatives
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/51411
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-01-12 08:58:53 +00:00
Darshan Sen 6cd678965f sea: add support for V8 bytecode-only caching
Refs: https://github.com/nodejs/single-executable/issues/73
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/48191
Fixes: https://github.com/nodejs/single-executable/issues/73
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-07-26 10:10:35 +00:00
Darshan Sen 4e0066eaf8 doc: fix typo in events.md
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/48436
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-06-12 16:15:04 +00:00
Darshan Sen 023e8803f8 doc,vm: clarify usage of cachedData in vm.compileFunction()
Fixes: https://github.com/nodejs/node/issues/48175
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/48193
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-05-29 01:26:22 +00:00
Darshan Sen a7a1fc5e0b test,doc,sea: run SEA tests on ppc64
The recent Postject upgrade, https://github.com/nodejs/node/pull/48072,
included a performance improvement for the injection operation
(see https://github.com/nodejs/postject/pull/86), so now it might be
possible to run the SEA tests on the ppc64 architecture runners on
Jenkins, which was previously getting timed out.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/48111
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-05-24 10:49:05 +00:00
Darshan Sen 78fe139b33 src: move BlobSerializerDeserializer to a separate header file
This should make it possible to reuse the BlobSerializer and the
BlobDeserializer classes in SEAs to generate and parse the injected
blob.

This change also resolves this TODO:
https://github.com/nodejs/node/blob/4f69aae6a04a460f267005dcf6551959064b3238/src/node_snapshotable.cc#L187

Refs: https://github.com/nodejs/node/pull/47458
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47933
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-05-11 18:19:24 +05:30
Darshan Sen 7fe4745ca1 module: refactor to use normalizeRequirableId in the CJS module loader
`BuiltinModule.normalizeRequirableId()` was introduced in
https://github.com/nodejs/node/pull/47779 to fix a bug in the require
function of SEAs and Snapshots, so that built-in modules with the
`node:` scheme could be required correctly. This change makes more use
of this API instead of `BuiltinModule.canBeRequiredByUsers()` and
`BuiltinModule.canBeRequiredWithoutScheme()` to reduce chances of
such bugs.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47896
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-05-08 08:17:13 +00:00
Darshan Sen 2de10f5149 sea: add option to disable the experimental SEA warning
Refs: https://github.com/nodejs/single-executable/discussions/60
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47588
Fixes: https://github.com/nodejs/node/issues/47741
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-05-04 15:27:54 +00:00
Darshan Sen c868aad15a sea: allow requiring core modules with the "node:" prefix
Previously, the `require()` function exposed to the embedded SEA code
was calling the internal `require()` function if the module name
belonged to the list of public core modules but the internal `require()`
function does not support loading modules with the "node:" prefix, so
this change forwards the calls to another `require()` function that
supports this.

Fixes: https://github.com/nodejs/single-executable/issues/69
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47779
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-05-04 14:32:35 +00:00
Darshan Sen 1ff9824094 src: remove usage of std::shared_ptr<T>::unique()
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change
uses `std::shared_ptr<T>::use_count()` instead which is available in
C++20.

Fixes: https://github.com/nodejs/node/issues/47311
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47315
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-04-05 17:45:56 +05:30
Darshan Sen 5db08cf693 sea: fix memory leak detected by asan
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47309
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-04-03 07:07:49 +00:00
Darshan Sen 86c831f643 doc,test: extend the list of platforms supported by single-executables
Now that https://github.com/nodejs/node/pull/46934 has landed, we can
extend the list of platforms and architectures where we can run the
single-executable test.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47026
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-03-11 08:58:52 +00:00
Darshan Sen 4cde39e817 doc: add steps about signing the binary in single-executable docs
We didn't catch this in https://github.com/nodejs/node/pull/45038
because the binary wasn't signed by default unlike the official Node.js
binary, which is signed by the Node.js Foundation identity by default.

Refs: https://github.com/nodejs/postject/issues/76 (macOS arm64 part only)
Fixes: https://github.com/nodejs/postject/issues/75
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/46764
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-26 12:26:40 +05:30
Darshan Sen 9bbde3d7ba src: add initial support for single executable applications
Compile a JavaScript file into a single executable application:

```console
$ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js

$ cp $(command -v node) hello

$ npx postject hello NODE_JS_CODE hello.js \
    --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2

$ npx postject hello NODE_JS_CODE hello.js \
    --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
    --macho-segment-name NODE_JS

$ ./hello world
Hello, world!
```

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45038
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2023-02-18 02:49:18 +00:00
Darshan Sen a37c083dc1 deps: copy postject-api.h and LICENSE to the deps folder
Since `postject-api.h` gets compiled into Node.js, it makes more sense
to put it in the `deps` directory instead of `test/fixtures`.

Refs: https://github.com/nodejs/node/pull/45038#discussion_r1100752158
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/46582
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-02-11 10:35:35 +05:30
Darshan Sen d7d9811407 tools: add automation for updating postject dependency
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/46157
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2023-01-14 07:49:36 +00:00
Darshan Sen e35e893d26 src: speed up process.getActiveResourcesInfo()
This change reduces the number of calls that were crossing the JS-C++
boundary to 1 and also removes the need for calling Array::New()
multiple times internally and ArrayPrototypeConcat-ing the results
later on, thus improving performance.

Refs: https://github.com/nodejs/node/pull/44445#pullrequestreview-1220052837
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/46014
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-01-03 10:36:25 +00:00
Darshan Sen 67a1994dd8 doc: replace single executable champion in strategic initiatives doc
Jesse has informed me that he won't be able to contribute to this
initiative, unfortunately. If you would like to know why, feel free to
ask him or me privately. I would like to take over.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45956
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-12-25 12:37:33 +00:00
Darshan Sen 167d7a9ee8 test: add postject to fixtures
This should make it possible to test out the creation of Single
Executable Applications on a PR without making outbound requests to
download and run postject using npm.

This is needed for https://github.com/nodejs/node/pull/45038.

Refs: https://github.com/nodejs/single-executable/blob/1840f3d9c5f4fa0d29aabd5618c4ff9745f7be87/meetings/2022-10-31.md?plain=1#L75-L76
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45298
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
2022-12-15 05:37:27 +00:00
Darshan Sen d55a7c3435 test: add a test to ensure the correctness of timezone upgrades
Currently, there's no way to know if a timezone upgrade PR is correct
without building and testing the change locally. This change provides a
solution for that.

Tested in https://github.com/RaisinTen/node/pull/4.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45299
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-11-10 13:08:30 +00:00
Darshan Sen 37b8a603f8 test: add test for Module._stat
Module._stat landed in https://github.com/nodejs/node/pull/44537 without
a test, so this change adds one.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44713
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
2022-10-25 11:48:19 +00:00
Darshan Sen 1a8f8ba6c6 build: add version info to timezone update PR
Refs: https://github.com/nodejs/node/pull/44950#issuecomment-1275073089
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45021
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-18 07:09:46 +00:00
Darshan Sen 91dbd8bb1c child_process: validate arguments for null bytes
This change adds validation to reject an edge case where the
child_process API argument strings might contain null bytes
somewhere in between. Such strings were being silently truncated
before, so throwing an error should prevent misuses of this API.

Fixes: https://github.com/nodejs/node/issues/44768
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44782
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-14 13:02:57 +00:00
Darshan Sen b5add9757d tools: remove faulty early termination logic from update-timezone.mjs
We do not build Node.js in the workflow so
https://github.com/nodejs/node/blob/f4815fcd7691364d8139b44c1295dbc46f6ee4a8/tools/update-timezone.mjs#L18
is actually the version of `tzdata` in the Node.js in the runner instead
of what's in `main`.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44870
Fixes: https://github.com/nodejs/node/issues/44865
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-10-10 15:23:50 +00:00
Darshan Sen 71e9bc1108 tools: fix timezone update tool
The spawnSync call was previously silently failing with this error:
```sh
icupkg: unable to open input file "icudt*.dat"
```
because spawnSync doesn't support globbing. This change replaces the
spawnSync call with execSync because that supports globbing.

I have tested this workflow with some minor modifications in my fork and
I can confirm that it works as expected now. The bot opened this PR -
https://github.com/RaisinTen/node/pull/2 which updates
deps/icu-small/source/data/in/icudt71l.dat.bz2.

Fixes: https://github.com/nodejs/node/issues/44865
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44870
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-10-10 15:23:50 +00:00
Darshan Sen 2a4452a53a tools: fix typo in tools/update-authors.mjs
The filename ends with an s.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44780
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
2022-09-30 05:49:00 +00:00
Darshan Sen 72aafbdba7 src: fix ssize_t error from nghttp2.h
The "node_http2.h" include reordering enforced by clang-format broke
Electron's Node.js upgrade on Windows. ssize_t is a part of the POSIX
standard and it's not available on Windows, so the fix for this is to
include "node.h" which typedefs it on Windows in
https://github.com/nodejs/node/blob/bb4dff783ddb3b20c67041f7ccef796c335c2407/src/node.h#L212-L220.

Refs: https://github.com/electron/electron/pull/35350#discussion_r954890551
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/44393
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-08-29 09:58:53 +00:00
Darshan Sen 7192ec1664 doc: clarify part of onboarding guide regarding adding to teams
There are a number of teams (for example, the build team) which require
more than just showing interest as a prerequisite for being added, so
this change adds a link to the set of subsystem teams where new
Collaborators can be added directy.

Also, the doc didn't actually mention if the new Collaborator should be
added to the team. This change also clarifies that.

Refs: https://github.com/nodejs/build/issues/3003
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/44024
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-07-31 07:59:27 +01:00
Darshan Sen 42eb2e72de src: use a typed array internally for process._exiting
This would prevent manual writes to the _exiting JS property on the
process object by passing the data directly via a typed array for
performance.

This change partially addresses this TODO:
https://github.com/nodejs/node/blob/3d575a4f1bd197c3ce669758a2a3c763462a883a/src/api/hooks.cc#L68-L71

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43883
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-07-31 07:32:00 +01:00
Darshan Sen a6e2329246 src: pass only Isolate* and env_vars to EnabledDebugList::Parse()
The function doesn't require access to the entire Environment object, so
this change just passes what it needs.

Addresses this TODO -
https://github.com/nodejs/node/blob/71691e53d601a4cf3eab3b33cebe4cc9f50c8470/src/env.cc#L372-L374

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43668
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-07-15 05:10:56 +01:00
Darshan Sen 08c8e85905 src,bootstrap: remove NodeMainInstance::registry_
All uses of NodeMainInstance::registry_ were removed in
https://github.com/nodejs/node/commit/43d2e247c7c198fcbbded3e13fa3996687848660,
so this change removes the variable completely.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43392
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-06-30 09:31:11 +01:00
Darshan Sen 49a5e81887 src: fix compiler warning in src/heap_utils.cc
Fixes: https://github.com/nodejs/node/issues/43577
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43579
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-06-29 15:09:04 +01:00
Darshan Sen 61c7103ed0 test: mark test-worker-http2-stream-terminate flaky on Windows
The test is causing a lot of CI failures, so I'd say that we should mark
this test flaky until someone comes up with a proper fix.

Refs: https://github.com/nodejs/node/issues/43084
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43425
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-06-18 01:49:44 +01:00
Darshan Sen ef70718552 src: register StreamBase while registering LibuvStreamWrap
This resolves this TODO -
https://github.com/nodejs/node/blob/71071f896aa9696b5d36bb3bec1c7217e7420509/src/stream_wrap.cc#L111-L112.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43321
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-06-17 09:33:06 +01:00
Darshan Sen 9a11ea14b7 build: add nonpm and nocorepack to vcbuild.bat
The `./configure` script allows you to produce a build without npm and
corepack with the `--without-npm` and `--without-corepack` options
respectively, so this change adds the same capability to the
`vcbuild.bat` script.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43219
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-06-02 16:39:08 +01:00
Darshan Sen 1496d43c18 src: convey potential exceptions during StreamPipe construction
This moves the V8 calls during the StreamPipe construction to an
overload of StreamPipe::New(), so that it is possible to indicate if
there is a pending exception/termination.

Refs: https://github.com/nodejs/node/pull/40425#discussion_r726975901
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43240
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2022-06-02 16:38:52 +01:00
Darshan Sen 7a71ae80b6 tools: update clang-format 1.7.0 to 1.8.0
v1.7.0 was shipping ARM64 binaries for macOS which doesn't run on Intel
Macs. v1.8.0 moved back to x86_64 binaries which works on both Intel
and M1 Macs.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43241
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-06-01 11:23:55 +01:00
Darshan Sen f91dcc205d src: delete AllocatedBuffer
Since all its uses are now gone, it's time to say goodbye to
AllocatedBuffer.

Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/43008
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-05-13 15:24:13 +01:00
Darshan Sen 30388fc796 bootstrap: stop delaying instantiation of maps in per-context scripts
The linked issue, https://bugs.chromium.org/p/v8/issues/detail?id=6593,
is marked as "Fixed", so I think we can revert this now.

This reverts commit 08a9c4a996.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42934
Refs: https://bugs.chromium.org/p/v8/issues/detail?id=9187
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-05-05 12:56:12 +01:00
Darshan Sen 7ff2170f36 src,crypto: remove uses of AllocatedBuffer from crypto_rsa.cc
Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42852
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-05-04 21:33:09 +01:00
Darshan Sen 1d8a320a04 worker: add hasRef() to MessagePort
Since we were removing the hasRef() method before exposing the
MessagePort object, the only way of knowing if the handle was keeping
the event loop active was to parse the string returned by
util.inspect(port), which is inconvenient and inconsistent with most of
the other async resources. So this change stops removing hasRef() from
the MessagePort prototype. The reason why this is also being documented
is that while reporting active resources, async_hooks returns the same
MessagePort object as the one that is accessible by users.

Refs: https://github.com/nodejs/node/issues/42091#issuecomment-1104793189
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42849
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-05-02 05:39:39 +01:00
Darshan Sen 709d27945d src,crypto: remove uses of AllocatedBuffer from crypto_ec.cc
Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42766
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-24 16:03:03 +01:00
Darshan Sen 61fefe1959 build: fix format-cpp
According to the logs in
https://github.com/nodejs/node/pull/42681#issuecomment-1100856089,
`make format-cpp` exits with an NZEC. This change intentionally ignores
the error code because it is irrelevant. We already check if the
formatter produced a diff in the next line.

Refs: https://github.com/nodejs/node/pull/42681#issuecomment-1100856089
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42764
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-04-20 16:00:22 +01:00
Darshan Sen 1b8d1794cf worker: add hasRef() to the handle object
This should help projects like
https://github.com/mafintosh/why-is-node-running and
https://github.com/facebook/jest to detect if Worker instances are
keeping the event loop active correctly.

Fixes: https://github.com/nodejs/node/issues/42091
Refs: https://github.com/mafintosh/why-is-node-running/issues/59
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42756
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-04-20 00:27:14 +01:00
Darshan Sen fc326d674d build: improve the format-cpp error message
This change specifies the target branch name instead of leaving that to
the committer to fill in.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42765
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-04-20 00:26:50 +01:00
Darshan Sen 19064bec34 test: delete test/pummel/test-repl-empty-maybelocal-crash.js
It was disconnecting the runners from the CI server. Not worth having a
resource-intensive test for this kind of an edge cases.

Fixes: https://github.com/nodejs/node/issues/42719
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/42720
Fixes: https://github.com/nodejs/node/issues/42719
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-04-14 20:32:29 +01:00
Darshan Sen 96673bcb96 build: run clang-format on CI
We already include the tool inside tools/clang-format, so we should
start using it on CI. This attempts to run the linter only on the
commits present in an opened PR.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42681
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-13 18:22:00 +01:00
Darshan Sen 0c57a37dd0 src,crypto: remove uses of AllocatedBuffer from crypto_tls.cc
Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42589
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-11 05:07:43 +01:00
Darshan Sen be01185844 src,inspector: fix empty MaybeLocal crash
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: https://github.com/nodejs/node/issues/42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42409
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-04-09 07:09:03 +01:00
Darshan Sen 0187bc5cdc v8: make v8.writeHeapSnapshot() error codes consistent
This change makes the error codes returned by v8.writeHeapSnapshot()
consistent across all platforms by using the libuv APIs instead of
fopen(), fwrite() and fclose(). This also starts reporting potential
errors that might happen during the write operations.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42577
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-04-05 14:55:51 +01:00
Darshan Sen f2a22ef179 src,crypto: handle empty maybe correctly in crypto_dh.cc
Buffer::Length() dereferences the passed Local, so calling it when the
underlying pointer is a nullptr would lead to a crash. This fixes that
by returning early instead.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42492
Refs: https://github.com/nodejs/node/pull/39941
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-03-31 04:29:55 +00:00
Darshan Sen 11c0da67f9 src: remove unnecessary static qualifier in crypto_dh.cc
ZeroPadDiffieHellmanSecret() is in an anonymous namespace, so it has
static linkage already.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42492
Refs: https://github.com/nodejs/node/pull/39941
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-03-31 04:29:54 +00:00
Darshan Sen 87a76d9de8 src,crypto: remove uses of AllocatedBuffer from crypto_dh.cc
Refs: https://github.com/nodejs/node/pull/39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42492
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-03-31 04:29:53 +00:00
Darshan Sen 5a138b5219 test,fs: add fs.rm() tests for .git directories
Git for Windows creates read-only files inside the .git directory.
fs.rm() was built in a way, to work around any EPERM error that can
happen while deleting the .git directory by turning the directory
into a writable one. This change adds a regression test for that.

Refs: https://github.com/isaacs/rimraf/issues/21
Refs: https://github.com/nodejs/node/pull/38810#issuecomment-1073152001
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42410
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-03-28 04:58:09 +01:00
Darshan Sen bc395d4c53 src: properly report exceptions from AddressToJS()
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42054
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-03-26 15:39:59 +00:00
Darshan Sen 46a0d0d4bf test,crypto: add and update empty passphrase regression tests
Refs: https://github.com/openssl/openssl/pull/17507
Refs: https://github.com/nodejs/node/issues/41428
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42319
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-03-19 09:24:41 +00:00
Darshan Sen 57529b22c4 src: convert hex2bin() into a regular function
No need to write hex2bin() as a function template because it's only
called with a char parameter.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42321
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-03-18 19:57:32 +00:00
Darshan Sen 82181bb9b8 test: fix failure in test/sequential/test-heapdump.js
The test was failing when it was being run with superuser privileges,
so this changes the test from attempting to write to a read-only file to
attempting to write to a file with the same name as that of an existing
directory, as that is a more reliable way of making
v8.writeHeapSnapshot() throw even when run with sudo.

Fixes: https://github.com/nodejs/node/issues/41643
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41772
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-03-14 18:33:09 +00:00
Darshan Sen 625c1e841a doc: clarify the meaning of legacy status
Fixes: https://github.com/nodejs/node/issues/42230
Fixes: https://github.com/nodejs/node/issues/42232

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42269
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-03-14 05:10:08 +00:00
Darshan Sen 6b004f1bb1 src,crypto: avoid tristate Maybe<bool> in ExportJWKEcKey()
The function currently uses the return value to convey whether an
exception was thrown while it was running by using either Just(true) or
Nothing<bool>(). Unfortunately, Maybe<bool> also has a third state -
Just(false), which doesn't make any sense here. So this change avoids
the possibility of a tristate return value by making use of Maybe<void>
which only has two valid states - JustVoid() / Nothing<void>(), which
fits right in.

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42223
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-03-08 22:40:28 +00:00
Darshan Sen 24fc302ead string_decoder: fix crash when calling __proto__.write()
This makes the function throw an exception from JS instead of crashing.

Fixes: https://github.com/nodejs/node/issues/41949
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/42062
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
2022-03-08 16:36:11 +00:00
Darshan Sen 5edad38328 src,buffer: evaluate THROW_AND_RETURN_IF_OOB() expression only once
There's no need to evaluate the expression passed into the macro more
than once.

Fixes: https://github.com/nodejs/node/issues/41935
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41945
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2022-02-18 00:05:42 +01:00
Darshan Sen a82c1a1da7 lib: stop installing fetch if no_browser_globals is true
Fixes: https://github.com/nodejs/node/issues/41816
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41969
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2022-02-16 16:53:43 +00:00
Darshan Sen ef4c115cc8 test: replace commented out expectations with tests
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41667
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-01-29 10:01:10 +00:00
Darshan Sen 726711fe4e node-api: add node_api_symbol_for()
Fixes: https://github.com/nodejs/node/issues/41294

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41329
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-01-24 16:35:07 -05:00
Darshan Sen 50b7ab9659 build: fix libuv builds for android aarch64
This syncs up the source list in
https://github.com/nodejs/node/blob/b2edcfee46097fe8e0510a455b97d5c6d0cac5ec/deps/uv/uv.gyp#L257-L265
with
https://github.com/nodejs/node/blob/b2edcfee46097fe8e0510a455b97d5c6d0cac5ec/deps/uv/CMakeLists.txt#L218-L227.

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

Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/41555
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-01-18 18:04:20 +00:00
Darshan Sen 64cc066f59 timers: use ref counts to count timers
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().

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

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/41231
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-01-02 15:28:23 +00:00
Darshan Sen ced5fc3930 assert: prefer reference comparison over string comparison
Pointer comparison takes constant time and string comparison takes
linear time unless there is some string interning going on, so this
might be a little bit faster.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/41015
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-12-14 14:58:47 +00:00
Darshan Sen 0d9f3bd9e8 process: add getActiveResourcesInfo()
This is supposed to be a public alternative of the private APIs,
`process._getActiveResources()` and `process._getActiveHandles()`. When
called, it returns an array of strings containing the types of the
active resources that are currently keeping the event loop alive.

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/40813
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-12-14 14:09:08 +00:00
Darshan Sen 90faf55510 src,crypto: remove uses of AllocatedBuffer from crypto_sig
Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/40895
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-11-27 15:55:25 +00:00
Darshan Sen 50f3428e21 src,crypto: use ByteSource::ToBuffer() in crypto_dh
Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/40903
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-11-25 00:14:49 +00:00
Darshan Sen 2b0087f3d4 Revert "async_hooks: merge resource_symbol with owner_symbol"
This reverts commit 7ca2f13039.

PR-URL: https://github.com/nodejs/node/pull/40741
Fixes: https://github.com/nodejs/node/issues/40693
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-11-18 18:42:27 +05:30
Darshan Sen ff3989572a Revert "lib: use helper for readability"
This reverts commit 937bbc5571.

PR-URL: https://github.com/nodejs/node/pull/40741
Fixes: https://github.com/nodejs/node/issues/40693
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-11-18 18:42:26 +05:30
Darshan Sen 1b8bfddf89 test: add AsyncLocalStorage tests using udp, tcp and tls sockets
Fixes: https://github.com/nodejs/node/issues/40693

Signed-off-by: Darshan Sen <darshan.sen@postman.com>

PR-URL: https://github.com/nodejs/node/pull/40741
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-11-18 18:42:23 +05:30