mmatczuk / go-http-tunnel

Fast and secure tunnels over HTTP/2
GNU Affero General Public License v3.0
3.24k stars 307 forks source link

too many open connections on socket after 3 hours of running the client #136

Open tylkomat opened 3 years ago

tylkomat commented 3 years ago

After 3 hours of running the client I get the following errors in the log (replaced IPs and Ports with placeholders)

proxy TCP level 1 msg TCP keepalive for tunneled connection failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err file tcp 127.0.0.1:33662->LOCAL_IP_PORT: fcntl: too many open files
proxy TCP level 0 msg dial failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err dial tcp LOCAL_IP_PORT: socket: too many open files
proxy TCP level 0 msg dial failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err dial tcp LOCAL_IP_PORT: socket: too many open files
TCP level 0 msg dial failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err dial tcp LOCAL_IP_PORT: socket: too many open files
TCP level 0 msg dial failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err dial tcp LOCAL_IP_PORT: socket: too many open files
proxy TCP level 0 msg dial failed target LOCAL_IP_PORT ctrlMsg &{proxy REMOTE_IP_PORT tcp TUNNEL_IP_PORT} err dial tcp LOCAL_IP_PORT: socket: too many open files
http: proxy error: dial tcp LOCAL2_IP_PORT: socket: too many open files

I configured two tunnels which are called quite often, the http tunnelevery 5 minutes and the tcp every couple of seconds. This is my config:

server_addr: TUNNEL_IP_PORT
tls_crt: TLS_CRT
tls_key: TLS_KEY
root_ca: ROOT_CRT
tunnels:
  tunnel1:
    proto: tcp
    addr: LOCAL_IP_PORT
    remote_addr: REMOTE_IP_PORT

  tunnel2:
    proto: http
    addr: LOCAL2_IP_PORT
    host: HOST_ADDR

backoff:
  interval: 10s
  multiplier: 1.5
  max_interval: 30m
  max_time: 0

Any idea what could be causing this?