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

RTCDataChannel not properly closed #286

Closed
Marcel-G opened this issue Aug 16, 2023 · 2 comments
Closed

RTCDataChannel not properly closed #286

Marcel-G opened this issue Aug 16, 2023 · 2 comments

Comments

@Marcel-G
Copy link

Problem

When RTCDataChannel: close() method on a JS client (Chrome for example) the data channel hangs in closing state and never transitions to closed.
This causes a memory leak and eventually more data channels cannot be created with the following error:

Uncaught (in promise) DOMException: Failed to execute 'createDataChannel' on 'RTCPeerConnection': RTCDataChannel creation failed

Reproduction

Checkout this branch: https://github.com/Marcel-G/str0m/tree/example/close-data-channel
Run cargo run --example http-post
Click Connect, and Run
Observe data channels not entering the closed state

Possible cause

I suspect the same issue as other libraries:

Chrome is waiting for a outgoingResetRequest before considering the channel closed.

@algesten
Copy link
Owner

@Marcel-G Thanks for reporting this!

With your repro, I have made a potential fix linked above.

The main problem I see with the fix is that it doesn't close straight away. At the points this is detected in the code, it's hard to schedule an immediate write, so the response close waits for the normal RTO, which is 3000ms. Hence I had to up your test cases to like 4000ms wait.

Maybe there's some way to make this faster.

@algesten
Copy link
Owner

This is sorted in b2c5392

Thanks!

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

No branches or pull requests

2 participants