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

Incoming payloads are silently truncated to 8kB #365

Closed
jech opened this issue Jan 19, 2019 · 6 comments
Closed

Incoming payloads are silently truncated to 8kB #365

jech opened this issue Jan 19, 2019 · 6 comments

Comments

@jech
Copy link
Member

jech commented Jan 19, 2019

If incoming payloads are larger than 8kB, they are silently truncated, which causes loss of data. I believe that there are two issues here:

  • there is no error indication when a packet is truncated;
  • 8kB is too small in any cases (the protocol that I'm trying to implement uses slightly over 16kB).

A simple workaround is to increase the value of receiveMTU in rtcpeerconnection.go¸ but that's obviously not satisfactory.

@backkem backkem transferred this issue from pion/sctp Jan 19, 2019
@backkem
Copy link
Member

backkem commented Jan 19, 2019

This is a known problem with the WebRTC API itself. It doesn't provide a good way to handle large messages. All implementations have some limitation. We can increase the default payload size but it would still be an arbitrary limit. A possible solution would be to make this configurable.
Alternatively, You can check out the detach example. This shows off an alternative way to interact with data channels. This API allows you to pass your own buffers for reading and writing, allowing you to determine their size. Note that we've probably done limited testing with large buffers so you may uncover some issues.

@jech
Copy link
Member Author

jech commented Jan 20, 2019

This is a known problem with the WebRTC API itself. It doesn't provide a good way to handle large messages

I still think there should be some sort of indication given to the application that the message has been truncated.

@jech
Copy link
Member Author

jech commented Jan 20, 2019

This is a known problem with the WebRTC API itself.

I'm confused — your link speaks of a protocol problem with SCTP, not an API problem. Couldn't the acceptSRTCP function reallocate the buffer when it is found to overflow, and then continue reading? Alternatively, couldn't the OnMessage callback return an io.Reader, as is done in gorilla.websocket?

@jech
Copy link
Member Author

jech commented Jan 20, 2019

I'm glad to report that Detach solved my problem quite nicely. Thanks.

@backkem
Copy link
Member

backkem commented Jan 20, 2019

I agree we should look into adding a warning. We'll keep the issue open untill then.

@backkem
Copy link
Member

backkem commented Jan 22, 2019

FYI, I did indeed link the wrong info above. For truly sending/receiving any size messages via the WebRTC API, it would have to be extended as suggested in w3c/webrtc-pc#1732.

backkem added a commit to pion/sctp that referenced this issue Jan 22, 2019
backkem added a commit to pion/sctp that referenced this issue Jan 22, 2019
backkem added a commit that referenced this issue Jan 23, 2019
backkem added a commit that referenced this issue Jan 23, 2019
backkem added a commit that referenced this issue Jan 23, 2019
backkem added a commit that referenced this issue Jan 23, 2019
backkem added a commit that referenced this issue Jan 23, 2019
@backkem backkem removed the review label Jan 23, 2019
Antonito pushed a commit to Antonito/webrtc that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants