Open Bug 1563771 Opened 6 years ago Updated 3 years ago

Reevaluate 2048 limit on number of DataChannels?

Categories

(Core :: WebRTC: Networking, task, P3)

task

Tracking

()

People

(Reporter: bwc, Unassigned)

Details

Is there a reason for this maximum? We aren't pre-allocating any resources based on this maximum.

Flags: needinfo?(rjesup)
Flags: needinfo?(lennart.grahl)

We aren't pre-allocating but usrsctp unfortunately does. From https://bugzilla.mozilla.org/show_bug.cgi?id=1562341#c18:

The problem is the amount of allocated memory (see also my earlier comment above). To quote Taylor Brandstetter in the corresponding Chromium issue:

We currently only negotiate 1024. I believe the main barrier is memory usage; usrsctp allocates 104 bytes (on a 64-bit system) for each stream, regardless of whether or not it's used, so negotiating the maximum number of streams would waste ~6MB.

This would be 6 MiB for each RTCPeerConnection. On top, you have to add the amount needed by the data channel library itself (if it does not allocate lazily). You can imagine what would happen when you fire up something like webtorrent.. on a mobile device. :)

Hence my request to get it fixed in usrsctp.

When using webtorrent, this can easily go beyond 100 MiB on a single tab just for the (unused) channels. That being said, each RTCPeerConnection will allocate at least 2 MiB anyway since we now have 1 MiB buffers for send/receive. I guess you will have to decide whether the additional 6 MiB are considered an issue. A much appreciated alternative would be to implement lazy allocation in usrsctp and get it upstream.

Flags: needinfo?(lennart.grahl)

(In reply to Lennart Grahl [:lgrahl] from comment #1)

We aren't pre-allocating but usrsctp unfortunately does. From https://bugzilla.mozilla.org/show_bug.cgi?id=1562341#c18:

So the pre-allocation happens here?

https://searchfox.org/mozilla-central/rev/9e980da78406a808663ba640773d386a2a02965a/netwerk/sctp/datachannel/DataChannel.cpp#580

AFAIK yes.

Correct (on all counts).

Flags: needinfo?(rjesup)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.