-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Handling ephemeral port exhaustion when using UDP protocol #21712
Comments
@mattklein123 @michalmaka looks like you're both quite familiar with the UdpProxy filter so perhaps you have thoughts here. |
Sorry I don't know the details of this and how Envoy could effect it. If there are kernel/socket options we could be applying here feel free to propose them.
Yes it's possible and is a partial duplicate of #15590 |
@mattklein123 usually when UDP socket is created for outgoing connection it should be created in following way:
these are so called connected UDP sockets (when creating socket we define the remote ip and port). Envoy is doing it like this:
and this one is unconnected UDP socket. The remote IP and port is known very late - when sending data. More details on this topic here. The drawback of unconnected socket in my situation is that each connection blocks exactly one local port. For connected sockets situation would be much better because |
Hmm TBH I don't remember why I did what I did when I originally wrote this code. It might be possible to move to the first version of what you have above without any implications? |
Well, I tried to investigate the envoy code, however my knowledge of c++ is too miserable. :( If the same udp socket is not reused for sending to multiple destinations then it should be safe. |
envoy/source/extensions/filters/udp/udp_proxy/udp_proxy_filter.h Lines 373 to 377 in a098234
That calls into code that does the bind. It could probably be swapped to connect instead. |
Title: Handling ephemeral port exhaustion when using UDP protocol
Description:
Hi! I'm using envoy to load balance UDP traffic for service similar to DNS (1 packet with query, 1 packet with response). Everything works fine until traffic burst causes ephemeral port exhaustion and no new UDP sockets can be created. I'm able to delay the problem with
idle_timeout
setting for UdpProxyConfig however it's not a long term solution.Questions:
Thanks for any hints! :)
The text was updated successfully, but these errors were encountered: