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

UDPMux causes massive packet loss #518

Open
jech opened this issue Aug 6, 2021 · 12 comments
Open

UDPMux causes massive packet loss #518

jech opened this issue Aug 6, 2021 · 12 comments
Labels
bug Something isn't working mux UDP and TCP Mux related issues

Comments

@jech
Copy link
Member

jech commented Aug 6, 2021

Testing UDPMux in Galene, I'm seeing absolutely massive packet loss on a local network, on the order of 50-70%.

The code is here: jech/galene@b80e515

@OrlandoCo
Copy link

@jech Have you tried to increase OS UDP buffer??

@jech
Copy link
Member Author

jech commented Aug 8, 2021

No. My current hypothesis is that it's the same issue as pion/webrtc#1356, which is apparently due to having multiple local addresses on a single local socket; that's going to happen on double-stack hosts, as well as on multihomed hosts.

@davidzhao
Copy link
Member

@jech we are using this (and TCPMux) with LiveKit and only see packet loss when UDP buffer gets overwhelmed. (increasing it gets rid of the loss for us).

https://github.com/livekit/livekit-server/blob/master/pkg/rtc/config.go#L70

Do you want to see if you can repro with LiveKit? I'm wondering there's something unique to your machine's networking stack.

You can start it with docker, and using UDPMux

docker run --rm \
  -p 7880:7880 \
  -p 7881:7881 \
  -p 7882:7882/udp \
  -e LIVEKIT_KEYS="<key>: <secret>" \
  livekit/livekit-server \
  --dev \
  --node-ip=<machine-ip>

@jech
Copy link
Member Author

jech commented Aug 9, 2021

Are your machines double-stack?

@davidzhao
Copy link
Member

what is considered double-stack? having both ipv4/6?

@jech
Copy link
Member Author

jech commented Aug 9, 2021 via email

@davidzhao
Copy link
Member

davidzhao commented Aug 9, 2021

With livekit we are using UDP4 with the mux and that could explain the difference. The challenge with dual-stack is ensuring what's advertised to match the dest addr that we sent to. I remember seeing some oddities along the lines of:

  • pion sends packet to client (udp4):clientport
  • client sends packet to pion, which got interpreted as (udp6):clientport
  • mux ignores udp6 address since it's different from the address that it sent to.

@jech
Copy link
Member Author

jech commented Aug 10, 2021

I don't know if the issue is the same as pion/webrtc#1356 (which has higher priority for me), but that issue goes away when I disable IPv6 (see pion/webrtc#1356 (comment)). Disabling IPv6 is of course not an option (IPv6 is great for WebRTC, IPv6 gives you a peer-reflexive candidate straight away, without the need to contact a STUN, which noticably reduces the connexion establishment delay).

@davidzhao
Copy link
Member

Disabling IPv6 is of course not an option

I agree having IPv6 is nice, but I would question if it's a must have. Is the slight connection speed improvement worth not having ICE/TCP? that is the decision today.

ofc it'd be ideal to fix the underlying issue.

@jech
Copy link
Member Author

jech commented Aug 10, 2021

The workaround is not a simple matter of disabling IPv6 for TCP-ICE — it requieres disabling IPv6 globally on the host. This means that you'll run into trouble as soon as somebody runs your code on a modern server.

What's more, the issue indicates that the code is buggy. Until the bug is understood and properly fixed, there's no saying when the code will bite you. Most probably during an important demo ;-)

@davidzhao
Copy link
Member

It'll only cause an issue on servers that don't support IPv4. we have not gotten any feedback about this. AFAIK, all major cloud vendors run their machines with dual stack.

But I digress, let's just fix the underlying issue.

Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
Antonito referenced this issue Mar 2, 2022
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
@stv0g
Copy link
Member

stv0g commented Jan 27, 2023

Lets move this issue to pion/ice..

@stv0g stv0g transferred this issue from pion/webrtc Jan 27, 2023
@stv0g stv0g added mux UDP and TCP Mux related issues bug Something isn't working labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mux UDP and TCP Mux related issues
Development

No branches or pull requests

4 participants