Skip to content

fix(webrtc): input backpressure#626

Open
gab8i wants to merge 4 commits into
masterfrom
gab_webrtc_input_backpressure_v2
Open

fix(webrtc): input backpressure#626
gab8i wants to merge 4 commits into
masterfrom
gab_webrtc_input_backpressure_v2

Conversation

@gab8i

@gab8i gab8i commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

The problem can be summarized in: inbound messages are forwarded from each SubstreamHandle to its Substream over a bounded channel using a blocking send().await, this imply that a slow Substream reader can stall the entire connection.

Real backpressure though isn't possible, reads come off one shared SCTP association, not per stream. You can't slow down a single reader, you would end up slowing down all substreams (original issue).

So at the end the solution that made more sense to me was to enforce a resource ceiling instead of chasing backpressure.

Earlier attempts added explicit pending-message accounting and pause/resume machinery to emulate some sort of per stream backpressure but at the end they all ended up with a limited buffer waiting to be exceeded. This solution reaches the same point but just with the least change as possible.

Closes #604

@gab8i gab8i requested review from dmitry-markin and lexnv and removed request for dmitry-markin June 23, 2026 11:05
Comment thread src/transport/webrtc/substream.rs Outdated
Comment thread src/transport/webrtc/substream.rs
@gab8i

gab8i commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@lexnv last 3 commits should have addressed your comments!

@gab8i gab8i requested a review from lexnv June 30, 2026 12:34
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.

webrtc: input backpressure

2 participants