You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
udp: default-on SO_REUSEPORT doesn't work with listening on port 0 #19283
This is for tracking the issue we discussed about SO_REUSEPORT in #19188. In Linux, if multiple Envoy instances are all configured to listen on port 0 for their UDP listeners, they may end up sharing the same port because of the default-on SO_REUSEPORT socket option if they are under the same user ID. This kernel behavior somewhat aligns with the contract of binding port 0 and SO_REUSEPORT. And a similar issue is explored here https://gavv.github.io/articles/ephemeral-port-reuse/.
This unexpected behavior was uncovered in QUIC integration tests because it affects UDP listeners which do not listen() more than TCP listeners. Currently SO_REUSEPORT is disabled in most of the integration tests(#19188) to prevent parallel bazel tests sharing the same port.
The mitigation is only in tests, not in production. Given that we aren't aware of any use case where Envoy is configured to listen on port 0 in production. But if there is, the Envoy should also explicitly disable SO_REUSEPORT like #19188 does. If both SO_REUSEPORT and listening on port 0 are desired, we need to revisit this issue and look into more sound solution, i.e. making Envoy manage a pool of ports.
Activity
phlax commentedon Dec 15, 2021
cc @alyssawilk @wrowe
ankatare commentedon Dec 28, 2021
Seems interesting. I would like to take this.
danzh2010 commentedon Jan 5, 2022
@ankatare this issue is mitigated in test already. Are you running into the same issue in production so that a more comprehensive solution is needed?
ankatare commentedon Jan 6, 2022
@danzh2010 Ohh.got it. We are not using envoy in production