Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d82019e
doc: fix grammar and editorial issues in addons documentation
Rawal27 Aug 4, 2026
11bdef4
deps: update nghttp3 to 1.18.0
nodejs-github-bot Aug 4, 2026
ece8bbe
deps: update ngtcp2 to 1.25.0
nodejs-github-bot Aug 2, 2026
5cef767
sqlite: prevent database close during callbacks
mcollina Aug 4, 2026
3fc98b8
stream: cut per-chunk allocations in pipeTo
mcollina Aug 4, 2026
72768c7
tools: add ./tools/nix/pkcs11.nix to nix-changes.yml
panva Aug 4, 2026
5b940dd
tls: drop hand-rolled TLS client hello parser
pimterry Jul 29, 2026
d18457b
tls: don't trigger SNICallback or OCSPRequest from the TLS lib stack
pimterry Aug 3, 2026
793a6ec
src: use UTF-8 for task runner filesystem paths
Archkon Aug 4, 2026
15495a0
doc: fix grammar and punctuation in dgram documentation
Rawal27 Aug 4, 2026
31cde9f
ffi: reuse libffi call plans
umuoy1 Aug 4, 2026
1576cb8
http2: increase default window sizes
mcollina Aug 4, 2026
500d048
test: prefer in-memory databases in sqlite tests
bitpshr Aug 4, 2026
427d2e1
build: add host toolset to perfetto_sdk
islandryu Aug 4, 2026
7cb4e7f
ffi: support SharedArrayBuffer in getRawPointer
ganjanggejang Aug 4, 2026
2010da5
doc: use ffi.suffix in permission example
agape1225 Aug 4, 2026
bd2e603
tools: remove `true` from branch name for auto-update automation
aduh95 Aug 4, 2026
3390622
tools: store "default" OpenSSL version in `openssl-matrix.nix`
aduh95 Aug 4, 2026
2b350bb
ffi: accept pointer BigInts in multi-argument fast calls
trivikr Aug 4, 2026
8465148
test_runner: fix env option validation
hanityx Aug 4, 2026
1fc74c8
build: enable perfetto updater
legendecas Aug 4, 2026
c8fa0b1
deps: upgrade npm to 11.19.0
npm-cli-bot Jul 31, 2026
6bab948
buffer: treat detached ArrayBuffers as empty
Archkon Aug 5, 2026
579fb17
tools: sync mk-ca-bundle.pl with curl
Archkon Aug 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/nix-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:

- name: Compute requisites before change
shell: bash # See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference, we want the pipefail option.
# TODO(panva): add `// import ./tools/nix/pkcs11.nix {}` once landed
run: |
git reset HEAD^ --hard
nix-store --query --references "$(
Expand All @@ -88,6 +87,7 @@ jobs:
++ builtins.attrValues (
{ inherit (import <nixpkgs> {}) nixfmt-tree sccache; }
// import ./tools/nix/openssl-matrix.nix {}
// import ./tools/nix/pkcs11.nix {}
)")" \
| xargs nix-store --realise \
| xargs nix-store --query --requisites \
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
- nghttp2
- nghttp3
- ngtcp2
- perfetto
- postject
- root-certificates
- simdjson
Expand Down Expand Up @@ -237,6 +238,14 @@ jobs:
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: perfetto
subsystem: deps
label: dependencies
run: |
./tools/dep_updaters/update-perfetto.sh > temp-output
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: postject
subsystem: deps,test
label: test
Expand Down Expand Up @@ -336,7 +345,7 @@ jobs:
# no-op if the base branch is already up-to-date.
with:
token: ${{ secrets.GH_USER_TOKEN }}
branch: actions/${{ github.ref_name == 'main' || format('{0}/', github.ref_name) }}tools-update-${{ matrix.id }} # Custom branch *just* for this Action.
branch: actions/${{ github.ref_name != 'main' && format('{0}/', github.ref_name) || '' }}tools-update-${{ matrix.id }} # Custom branch *just* for this Action.
delete-branch: true
commit-message: ${{ env.COMMIT_MSG }}
labels: ${{ matrix.label }}
Expand Down
79 changes: 79 additions & 0 deletions benchmark/ffi/invoke-function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
'use strict';

const assert = require('node:assert');
const common = require('../common.js');
const { libraryPath, ensureFixtureLibrary } = require('./common.js');

// Measure the invocation (call) path for signatures that bypass V8 Fast API
// and use libffi through FFIFunction::Invoke(). On x86-64 System V with
// libffi >= 3.7, Invoke() reuses a precomputed call plan that avoids repeating
// argument-placement work on every call. This benchmark quantifies the
// per-call benefit.
//
// Signatures chosen to bypass both V8 Fast API and keep native work minimal:
// - call_int_callback (null): 'function' type forces the generic path; null
// pointer triggers the early return in C so native computation is negligible.
// From libffi's perspective this is a register-only plan (2 pointer-sized
// args both fit in GP registers on x86-64 System V).
// - sum_8_i32: 8 GP args exceed the x86-64 Fast API register cap (6), forcing
// the generic path. From libffi's perspective 6 args go in registers and 2
// spill to the stack, exercising a stack-spilled plan.

const bench = common.createBenchmark(main, {
n: [1e7],
symbol: ['call_int_callback', 'sum_8_i32'],
}, {
flags: ['--experimental-ffi', '--no-warnings'],
});

ensureFixtureLibrary();

function main({ n, symbol }) {
const ffi = require('node:ffi');

if (symbol === 'call_int_callback') {
// 'function' type bypasses Fast API (IsFastCallEligible rejects it).
// Pass 0n (null function pointer) so the native function returns -1
// immediately without invoking any callback, keeping per-call overhead
// dominated by the FFI call machinery itself.
const { lib, functions } = ffi.dlopen(libraryPath, {
call_int_callback: { return: 'i32', arguments: ['function', 'i32'] },
});

try {
// Verify the null-pointer early return.
assert.strictEqual(functions.call_int_callback(0n, 7), -1);

bench.start();
for (let i = 0; i < n; ++i)
functions.call_int_callback(0n, 21);
bench.end(n);
} finally {
lib.close();
}
} else {
// 8 integer args exceed the x86-64 SysV GP register cap (6), which makes
// CreateFastFFIMetadata reject the signature. Calls go through the
// SharedBuffer or generic invoker into FFIFunction::Invoke().
const { lib, functions } = ffi.dlopen(libraryPath, {
sum_8_i32: {
return: 'i32',
arguments: [
'i32', 'i32', 'i32', 'i32',
'i32', 'i32', 'i32', 'i32',
],
},
});

const fn = functions.sum_8_i32;

assert.strictEqual(fn(1, 2, 3, 4, 5, 6, 7, 8), 36);

bench.start();
for (let i = 0; i < n; ++i)
fn(1, 2, 3, 4, 5, 6, 7, 14);
bench.end(n);

lib.close();
}
}
127 changes: 125 additions & 2 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
/**
* @functypedef
*
* :type:`nghttp3_conn_stream_close` is a callback function which is
* :type:`nghttp3_stream_close` is a callback function which is
* invoked when a stream identified by |stream_id| is closed. QUIC
* application error code |app_error_code| indicates the reason of
* this closure.
Expand All @@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*
* .. seealso::
* :type:`nghttp3_stream_close2`
*/
typedef int (*nghttp3_stream_close)(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code,
Expand Down Expand Up @@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
const nghttp3_proto_settings *settings,
void *conn_user_data);

/**
* @macrosection
*
* Stream close flags
*/

/**
* @macro
*
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
*
* .. version-added:: 1.18.0
*/
#define NGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U

/**
* @macro
*
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
* that rx_app_error_code parameter is set.
*
* .. version-added:: 1.18.0
*/
#define NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U

/**
* @macro
*
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
* that tx_app_error_code parameter is set.
*
* .. version-added:: 1.18.0
*/
#define NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U

/**
* @functypedef
*
* :type:`nghttp3_stream_close2` is a callback function which is
* invoked when a stream identified by |stream_id| is closed. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
* |flags|, |rx_app_error_code| is the QUIC application error code
* that shut down the receiving side of the stream. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
* |flags|, |tx_app_error_code| is the QUIC application error code
* that shut down the sending side of the stream. No application code
* means that direction of stream is closed without any error.
*
* This callback should be used with `nghttp3_conn_close_stream2`. If
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
* both |rx_app_error_code| and |tx_app_error_code|, and
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
* |flags|.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*
* .. version-added:: 1.18.0
*/
typedef int (*nghttp3_stream_close2)(nghttp3_conn *conn, uint32_t flags,
int64_t stream_id,
uint64_t rx_app_error_code,
uint64_t tx_app_error_code,
void *conn_user_data,
void *stream_user_data);

#define NGHTTP3_CALLBACKS_V1 1
#define NGHTTP3_CALLBACKS_V2 2
#define NGHTTP3_CALLBACKS_V3 3
#define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
#define NGHTTP3_CALLBACKS_V4 4
#define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4

/**
* @struct
Expand All @@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
/**
* :member:`stream_close` is a callback function which is invoked
* when a particular stream has closed.
*
* .. seealso::
* :member:`stream_close2`
*/
nghttp3_stream_close stream_close;
/**
Expand Down Expand Up @@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
* .. version-added:: 1.11.0
*/
nghttp3_rand rand;
/* The following fields have been added since
NGHTTP3_CALLBACKS_V3. */
/**
* :member:`recv_settings2` is a callback function which is invoked
* when SETTINGS frame is received.
*
* .. version-added:: 1.14.0
*/
nghttp3_recv_settings2 recv_settings2;
/* The following fields have been added since
NGHTTP3_CALLBACKS_V4. */
/**
* :member:`stream_close2` is a callback function which is invoked
* when a particular stream has closed.
*
* .. version-added:: 1.18.0
*/
nghttp3_stream_close2 stream_close2;
} nghttp3_callbacks;

/**
Expand Down Expand Up @@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
* A critical stream is closed.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed
*
* .. seealso::
* `nghttp3_conn_close_stream2`
*/
NGHTTP3_EXTERN int nghttp3_conn_close_stream(nghttp3_conn *conn,
int64_t stream_id,
uint64_t app_error_code);

/**
* @function
*
* `nghttp3_conn_close_stream2` tells the library that a stream
* identified by |stream_id| has been closed. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
* |flags|, |rx_app_error_code| is the QUIC application error code
* that shut down the receiving side of the stream. Similarly,
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
* |flags|, |tx_app_error_code| is the QUIC application error code
* that shut down the sending side of the stream.
*
* For stream close callback, prefer
* :member:`nghttp3_callbacks.stream_close2` to
* :member:`nghttp3_callbacks.stream_close`.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found.
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
* A critical stream is closed.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed
*
* .. version-added:: 1.18.0
*/
NGHTTP3_EXTERN int nghttp3_conn_close_stream2(nghttp3_conn *conn,
uint32_t flags, int64_t stream_id,
uint64_t rx_app_error_code,
uint64_t tx_app_error_code);

/**
* @macrosection
*
Expand Down
4 changes: 2 additions & 2 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* Version number of the nghttp3 library release.
*/
#define NGHTTP3_VERSION "1.17.0"
#define NGHTTP3_VERSION "1.18.0"

/**
* @macro
Expand All @@ -41,6 +41,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
#define NGHTTP3_VERSION_NUM 0x011100
#define NGHTTP3_VERSION_NUM 0x011200

#endif /* !defined(NGHTTP3_VERSION_H) */
3 changes: 3 additions & 0 deletions deps/ngtcp2/nghttp3/lib/nghttp3_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ size_t nghttp3_callbackslen_version(int callbacks_version) {
switch (callbacks_version) {
case NGHTTP3_CALLBACKS_VERSION:
return sizeof(callbacks);
case NGHTTP3_CALLBACKS_V3:
return offsetof(nghttp3_callbacks, recv_settings2) +
sizeof(callbacks.recv_settings2);
case NGHTTP3_CALLBACKS_V2:
return offsetof(nghttp3_callbacks, rand) + sizeof(callbacks.rand);
case NGHTTP3_CALLBACKS_V1:
Expand Down
Loading
Loading