Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v21.6.1 proposal #51530

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V21.md#21.6.0">21.6.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V21.md#21.6.1">21.6.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V21.md#21.6.0">21.6.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V21.md#21.5.0">21.5.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V21.md#21.4.0">21.4.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V21.md#21.3.0">21.3.0</a><br/>
Expand Down
14 changes: 14 additions & 0 deletions doc/changelogs/CHANGELOG_V21.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</tr>
<tr>
<td>
<a href="#21.6.1">21.6.1</a><br/>
<a href="#21.6.0">21.6.0</a><br/>
<a href="#21.5.0">21.5.0</a><br/>
<a href="#21.4.0">21.4.0</a><br/>
Expand Down Expand Up @@ -42,6 +43,19 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)

<a id="21.6.1"></a>

## 2024-01-22, Version 21.6.1 (Current), @RafaelGSS

### Notable Changes

This release fixes a bug in `undici` using WebStreams

### Commits

* \[[`662ac95729`](https://github.com/nodejs/node/commit/662ac95729)] - _**Revert**_ "**stream**: fix cloned webstreams not being unref'd" (Matteo Collina) [#51491](https://github.com/nodejs/node/pull/51491)
* \[[`1b8bba8aee`](https://github.com/nodejs/node/commit/1b8bba8aee)] - **test**: add regression test for 51586 (Matteo Collina) [#51491](https://github.com/nodejs/node/pull/51491)

<a id="21.6.0"></a>

## 2024-01-15, Version 21.6.0 (Current), @RafaelGSS
Expand Down
2 changes: 0 additions & 2 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,6 @@ class ReadableStream {

[kTransferList]() {
const { port1, port2 } = new MessageChannel();
port1.unref();
port2.unref();
this[kState].transfer.port1 = port1;
this[kState].transfer.port2 = port2;
return [ port2 ];
Expand Down
4 changes: 1 addition & 3 deletions lib/internal/webstreams/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ class CrossRealmTransformReadableSource {
error);
port.close();
};

port.unref();
}

start(controller) {
Expand Down Expand Up @@ -212,7 +210,7 @@ class CrossRealmTransformWritableSink {
error);
port.close();
};
port.unref();

}

start(controller) {
Expand Down
2 changes: 0 additions & 2 deletions lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ class WritableStream {

[kTransferList]() {
const { port1, port2 } = new MessageChannel();
port1.unref();
port2.unref();
this[kState].transfer.port1 = port1;
this[kState].transfer.port2 = port2;
return [ port2 ];
Expand Down
2 changes: 1 addition & 1 deletion src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define NODE_VERSION_IS_LTS 0
#define NODE_VERSION_LTS_CODENAME ""

#define NODE_VERSION_IS_RELEASE 0
#define NODE_VERSION_IS_RELEASE 1

#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
Expand Down
28 changes: 28 additions & 0 deletions test/parallel/test-webstream-structured-clone-no-leftovers.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import '../common/index.mjs';
import { test } from 'node:test';
import assert from 'node:assert';

test('do not leak promises', async () => {
const buf = new Uint8Array(1);
const readable = new ReadableStream({
start(controller) {
controller.enqueue(buf);
controller.close();
}
});

const [out1, out2] = readable.tee();
const cloned = structuredClone(out2, { transfer: [out2] });

for await (const chunk of cloned) {
assert.deepStrictEqual(chunk, buf);
}

for await (const chunk of out2) {
assert.deepStrictEqual(chunk, buf);
}

for await (const chunk of out1) {
assert.deepStrictEqual(chunk, buf);
}
});
16 changes: 0 additions & 16 deletions test/parallel/test-webstreams-clone-unref.js

This file was deleted.

11 changes: 0 additions & 11 deletions test/parallel/test-whatwg-webstreams-transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,23 +464,12 @@ const theData = 'hello';
tracker.verify();
});

// We create an interval to keep the event loop alive while
// we wait for the stream read to complete. The reason this is needed is because there's
// otherwise nothing to keep the worker thread event loop alive long enough to actually
// complete the read from the stream. Under the covers the ReadableStream uses an
// unref'd MessagePort to communicate with the main thread. Because the MessagePort
// is unref'd, it's existence would not keep the thread alive on its own. There was previously
// a bug where this MessagePort was ref'd which would block the thread and main thread
// from terminating at all unless the stream was consumed/closed.
const i = setInterval(() => {}, 1000);

parentPort.onmessage = tracker.calls(({ data }) => {
assert(isReadableStream(data));
const reader = data.getReader();
reader.read().then(tracker.calls((result) => {
assert(!result.done);
assert(result.value instanceof Uint8Array);
clearInterval(i);
}));
parentPort.close();
});
Expand Down