fabiolb / fabio

Consul Load-Balancing made simple
https://fabiolb.net
MIT License
7.25k stars 619 forks source link

TCP Dynamic Proxy is not releasing ports from deregistered services #796

Closed fwkz closed 3 years ago

fwkz commented 3 years ago

Abstract

fabio leaves dangling ports from deregistered services that used TCP Dynamic Proxy

Steps to reproduce

  1. Start fabio:1.5.14-go1.15 docker container with FABIO_PROXY_ADDR=":9999,0.0.0.0:0;proto=tcp-dynamic;refresh=5s" and host networking.
  2. Register 2 consul services that will use TCP Dynamic Proxy
    
    netstat -tulpn | grep fabio                                                                                                                                                          nomad-1: Tue Oct 27 16:37:20 2020

tcp6 0 0 :::31130 ::: LISTEN 29060/fabio tcp6 0 0 :::24604 ::: LISTEN 29060/fabio tcp6 0 0 :::9998 ::: LISTEN 29060/fabio tcp6 0 0 :::9999 ::: LISTEN 29060/fabio

3. Deregister one of the consul services. Port `31130` is dangling, despite the fact that the underlying service is deregistered and no longer visible on Fabio UI (http://foobar.fabio.ui:9998/routes)

netstat -tulpn | grep fabio nomad-1: Tue Oct 27 16:37:20 2020

tcp6 0 0 :::31130 ::: LISTEN 29060/fabio tcp6 0 0 :::24604 ::: LISTEN 29060/fabio tcp6 0 0 :::9998 ::: LISTEN 29060/fabio tcp6 0 0 :::9999 ::: LISTEN 29060/fabio

4. Restart `fabio` container to see if it will release ports and start properly. 

netstat -tulpn | grep fabio nomad-1: Tue Oct 27 16:37:20 2020

tcp6 0 0 :::24604 ::: LISTEN 29060/fabio tcp6 0 0 :::9998 ::: LISTEN 29060/fabio tcp6 0 0 :::9999 :::* LISTEN 29060/fabio

evandam commented 3 years ago

I'm seeing the same issue using tcp-dynamic as well. Any way this can be fixed soon?