Closed jparklab closed 2 years ago
cc @mattklein123 @alyssawilk
I think the issue is this function needs to be aware of TCP vs. UDP:
I think TCP vs. UDP is being passed across the hot restart RPC but AFAICT it's being stripped before doing the actual lookup.
@mattklein123 I think you are right. I no longer see the issue when I change the if statement as below to compare socket type
if (*socket_factory.localAddress() == *addr && listener.get().bindToPort() &&
(socket_factory.socketType() == Network::Socket::Type::Stream) ==
Network::Utility::urlIsTcpScheme(request.pass_listen_socket().address())) {
@jparklab are you going to fix this? if not, I happy to help here
@soulxu I will create a PR with a fix to check the socket type. I'll tag you for the review
@soulxu I created a PR: https://github.com/envoyproxy/envoy/pull/20605, can you take a look?
Title: Envoy fails to bind to a port after hot restart when the port is used for both UDP and TCP
Description: After a hot restart, envoy fails to finish initialization with the following error message
It happens to listener using TCP protocol that binds to a port that is also bound to by another listener using UDP protocol.
Repro steps:
The issue can be reproduced by running envoy with a configuration that has a UDP listener and a TCP listener that bind to the same address, and hot restart it.
Here's the envoy configuration, and start-service.sh I used to reproduce the issue
envoy-config.yaml:
start-service.sh:
It appears that it only happens when the UDP listener binds to the port before the TCP listener. I can always reproduce the issue when I run the envoy with UDP listener only, and hot restart it after adding TCP listener. The issue does not happen when I run envoy with TCP listener only and hot restart after adding UDP listener.
Logs:
I was able to reproduce the issue with envoy 1.20.0, and envoy built from the HEAD.