From 4557c13c21742bfc8c6357dd87bc3a9904e8c792 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Fri, 9 Aug 2024 18:03:04 -0400 Subject: [PATCH] deps: update undici to 6.19.7 PR-URL: https://github.com/nodejs/node/pull/54286 Reviewed-By: Matteo Collina Reviewed-By: Marco Ippolito Reviewed-By: Matthew Aitken Reviewed-By: Trivikram Kamat Reviewed-By: Rafael Gonzaga --- deps/undici/src/build/wasm.js | 2 +- deps/undici/src/lib/llhttp/wasm_build_env.txt | 8 +++--- deps/undici/src/lib/web/fetch/response.js | 12 ++++++-- deps/undici/src/package-lock.json | 28 +++++++++---------- deps/undici/src/package.json | 2 +- deps/undici/undici.js | 7 +++-- src/undici_version.h | 2 +- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/deps/undici/src/build/wasm.js b/deps/undici/src/build/wasm.js index 0e86e11f195175..2f65c0e1d74159 100644 --- a/deps/undici/src/build/wasm.js +++ b/deps/undici/src/build/wasm.js @@ -62,7 +62,7 @@ if (process.argv[2] === '--prebuild') { } if (process.argv[2] === '--docker') { - let cmd = `docker run --rm -it --platform=${platform.toString().trim()}` + let cmd = `docker run --rm -t --platform=${platform.toString().trim()}` if (process.platform === 'linux') { cmd += ` --user ${process.getuid()}:${process.getegid()}` } diff --git a/deps/undici/src/lib/llhttp/wasm_build_env.txt b/deps/undici/src/lib/llhttp/wasm_build_env.txt index 1823707e0dfd3f..cef6c799b6a14e 100644 --- a/deps/undici/src/lib/llhttp/wasm_build_env.txt +++ b/deps/undici/src/lib/llhttp/wasm_build_env.txt @@ -1,15 +1,15 @@ -> undici@6.19.5 prebuild:wasm +> undici@6.19.7 prebuild:wasm > node build/wasm.js --prebuild -> docker build --platform=linux/x86_64 -t llhttp_wasm_builder -f /home/midawson/test-undici/io.js/deps/undici/src/build/Dockerfile /home/midawson/test-undici/io.js/deps/undici/src +> docker build --platform=linux/x86_64 -t llhttp_wasm_builder -f /home/runner/work/node/node/deps/undici/src/build/Dockerfile /home/runner/work/node/node/deps/undici/src -> undici@6.19.5 build:wasm +> undici@6.19.7 build:wasm > node build/wasm.js --docker -> docker run --rm -it --platform=linux/x86_64 --user 1003:1003 --mount type=bind,source=/home/midawson/test-undici/io.js/deps/undici/src/lib/llhttp,target=/home/node/undici/lib/llhttp llhttp_wasm_builder node build/wasm.js +> docker run --rm -t --platform=linux/x86_64 --user 1001:127 --mount type=bind,source=/home/runner/work/node/node/deps/undici/src/lib/llhttp,target=/home/node/undici/lib/llhttp llhttp_wasm_builder node build/wasm.js alpine-baselayout-3.4.3-r2 diff --git a/deps/undici/src/lib/web/fetch/response.js b/deps/undici/src/lib/web/fetch/response.js index 8c00835698e040..603410a4a63e4a 100644 --- a/deps/undici/src/lib/web/fetch/response.js +++ b/deps/undici/src/lib/web/fetch/response.js @@ -34,8 +34,9 @@ const hasFinalizationRegistry = globalThis.FinalizationRegistry && process.versi let registry if (hasFinalizationRegistry) { - registry = new FinalizationRegistry((stream) => { - if (!stream.locked && !isDisturbed(stream) && !isErrored(stream)) { + registry = new FinalizationRegistry((weakRef) => { + const stream = weakRef.deref() + if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) { stream.cancel('Response object has been garbage collected').catch(noop) } }) @@ -526,7 +527,12 @@ function fromInnerResponse (innerResponse, guard) { setHeadersGuard(response[kHeaders], guard) if (hasFinalizationRegistry && innerResponse.body?.stream) { - registry.register(response, innerResponse.body.stream) + // If the target (response) is reclaimed, the cleanup callback may be called at some point with + // the held value provided for it (innerResponse.body.stream). The held value can be any value: + // a primitive or an object, even undefined. If the held value is an object, the registry keeps + // a strong reference to it (so it can pass it to the cleanup callback later). Reworded from + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry + registry.register(response, new WeakRef(innerResponse.body.stream)) } return response diff --git a/deps/undici/src/package-lock.json b/deps/undici/src/package-lock.json index d278ababa71230..5c3f78dec80f4b 100644 --- a/deps/undici/src/package-lock.json +++ b/deps/undici/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "undici", - "version": "6.19.5", + "version": "6.19.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "undici", - "version": "6.19.5", + "version": "6.19.7", "license": "MIT", "devDependencies": { "@fastify/busboy": "2.1.1", @@ -1650,9 +1650,9 @@ "license": "MIT" }, "node_modules/@types/yargs": { - "version": "17.0.32", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", - "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "dev": true, "license": "MIT", "dependencies": { @@ -2575,9 +2575,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001649", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz", - "integrity": "sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ==", + "version": "1.0.30001651", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", + "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", "dev": true, "funding": [ { @@ -4331,9 +4331,9 @@ } }, "node_modules/fast-check": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.20.0.tgz", - "integrity": "sha512-pZIjqLpOZgdSLecec4GKC3Zq5702MZ34upMKxojnNVSWA0K64V3pXOBT1Wdsrc3AphLtzRBbsi8bRWF4TUGmUg==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.21.0.tgz", + "integrity": "sha512-QpmbiqRFRZ+SIlBJh6xi5d/PgXciUc/xWKc4Vi2RWEHHIRx6oM3f0fWNna++zP9VB5HUBTObUK9gTKQP3vVcrQ==", "dev": true, "funding": [ { @@ -4501,9 +4501,9 @@ } }, "node_modules/foreground-child": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", - "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", "dev": true, "license": "ISC", "dependencies": { diff --git a/deps/undici/src/package.json b/deps/undici/src/package.json index 88aa14df839b3e..86fbc7e26b36f2 100644 --- a/deps/undici/src/package.json +++ b/deps/undici/src/package.json @@ -1,6 +1,6 @@ { "name": "undici", - "version": "6.19.5", + "version": "6.19.7", "description": "An HTTP/1.1 client, written from scratch for Node.js", "homepage": "https://undici.nodejs.org", "bugs": { diff --git a/deps/undici/undici.js b/deps/undici/undici.js index 049b0aedb8992e..b2e064facf2a64 100644 --- a/deps/undici/undici.js +++ b/deps/undici/undici.js @@ -8749,8 +8749,9 @@ var require_response = __commonJS({ var hasFinalizationRegistry = globalThis.FinalizationRegistry && process.version.indexOf("v18") !== 0; var registry; if (hasFinalizationRegistry) { - registry = new FinalizationRegistry((stream) => { - if (!stream.locked && !isDisturbed(stream) && !isErrored(stream)) { + registry = new FinalizationRegistry((weakRef) => { + const stream = weakRef.deref(); + if (stream && !stream.locked && !isDisturbed(stream) && !isErrored(stream)) { stream.cancel("Response object has been garbage collected").catch(noop); } }); @@ -9064,7 +9065,7 @@ var require_response = __commonJS({ setHeadersList(response[kHeaders], innerResponse.headersList); setHeadersGuard(response[kHeaders], guard); if (hasFinalizationRegistry && innerResponse.body?.stream) { - registry.register(response, innerResponse.body.stream); + registry.register(response, new WeakRef(innerResponse.body.stream)); } return response; } diff --git a/src/undici_version.h b/src/undici_version.h index f66357f17dfd00..ac384500e05a5d 100644 --- a/src/undici_version.h +++ b/src/undici_version.h @@ -2,5 +2,5 @@ // Refer to tools/dep_updaters/update-undici.sh #ifndef SRC_UNDICI_VERSION_H_ #define SRC_UNDICI_VERSION_H_ -#define UNDICI_VERSION "6.19.5" +#define UNDICI_VERSION "6.19.7" #endif // SRC_UNDICI_VERSION_H_