Skip to content

Prevent GC of non-closed RTCDataChannels #2902

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

Merged
merged 5 commits into from
Nov 2, 2023
Merged

Conversation

jan-ivar
Copy link
Member

@jan-ivar jan-ivar commented Oct 6, 2023

Fixes #2624.


Preview | Diff

@jan-ivar jan-ivar self-assigned this Oct 6, 2023
@jan-ivar
Copy link
Member Author

],
"closing-procedure": [
{
"description": "Prevent GC of non-closed RTCDataChannels",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-closing/non-closed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given where we're removing the channel I'm not sure we're preventing GC of non-closing channels?

webrtc.html Outdated
</li>
<li>
<p>
Remove <var>channel</var> from <var>connection</var>.{{RTCPeerConnection/[[DataChannels]]}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems good to do it there so that calling close() will remove synchronously the dc from the set.
What about the case of a transport that gets errored?
Shouldn't we also do the same in https://w3c.github.io/webrtc-pc/#announcing-a-data-channel-as-closed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that "procedure" is also an algorithm called from https://w3c.github.io/webrtc-pc/#data-transport-closing-procedure

There's also this note suggesting the closing procedure is called from somewhere other than close() but it's not.
image

Copy link
Contributor

@alvestrand alvestrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only nit here is that "Ordered set" sounds prescriptive of implementation while seeming to have no JS-visible effect. I like minimally-constraining descriptions.

@alvestrand alvestrand merged commit 813e08c into w3c:main Nov 2, 2023
@jan-ivar jan-ivar deleted the datachannels branch November 2, 2023 15:45
@jan-ivar
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should garbage collecting RTCDataChannels be observable?
6 participants