libp2p / libp2p/rust-libp2p

webrtc Flag not being transferred

Open
#5,877 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
1.3k
Avg merge
8h 47m
Merged PRs (30d)
19

Description

Summary

When a webrtc stream is closed, a Flag::FIN is sent, but the remote never gets the flag. Same with Flag::RESET, it's never received by the remote peer.

In fact, I don't see any Flags being received.

This results in a webrtc-utils stream being closed on one end, but left to timeout on the other end.

Specifically this is a problem right after handshake, where the noise DataChannel is left to timeout after 10 seconds, then a new data channel is established and streams can flow.

The impact is that WebRtc can only be used after this 10 second timeout until the new datachannel is made to replace the closed one.

Expected behavior

It's expected that when

https://github.com/libp2p/rust-libp2p/blob/9e0e8becfc75c6560b858dd0d4f5eb545f13cf18/misc/webrtc-utils/src/stream.rs#L228-L231

is called, that the remote received the Flag

Actual behavior

No inbound Flag (FIN, RESET) appears to be received by the remote. In fact, this code never seems to be called:

https://github.com/libp2p/rust-libp2p/blob/9e0e8becfc75c6560b858dd0d4f5eb545f13cf18/misc/webrtc-utils/src/stream/state.rs#L59-L81

Relevant log output

Possible Solution

I can't tell why the FIN and RESET flags are not being received. The code looks like it should work fine, yet we have an absence of these Flags.

Version

0.54.1

Would you like to work on fixing this bug?

I'll try

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in misc/webrtc-utils/src/stream.rs at lines 228-231 and inspect misc/webrtc-utils/src/stream/state.rs at lines 59-81, then reproduce the post-handshake stream-close case. Trace why FIN and RESET do not reach the remote peer; done means inbound flags are observed and the noise DataChannel no longer waits for the 10-second timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
audio-video-rtc, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.