Преглед изворни кода

fix: close connection on worker pool overflow

When the worker pool rejected a connection (ErrPoolOverload), the
accepted net.Conn was never closed — leaking a file descriptor and
TCP socket per rejected connection. Under sustained traffic spikes this
compounds the problem: leaked descriptors reduce the capacity for new
dials (including to the fronting domain), accelerating the failure
cascade described in #378.
tags/v2.2.5^2^2
Alexey Dolotov пре 1 месец
родитељ
комит
289bb283b1
1 измењених фајлова са 1 додато и 0 уклоњено
  1. 1
    0
      mtglib/proxy.go

+ 1
- 0
mtglib/proxy.go Прегледај датотеку

@@ -152,6 +152,7 @@ func (p *Proxy) Serve(listener net.Listener) error {
152 152
 		case errors.Is(err, ants.ErrPoolClosed):
153 153
 			return nil
154 154
 		case errors.Is(err, ants.ErrPoolOverload):
155
+			conn.Close() //nolint: errcheck
155 156
 			logger.Info("connection was concurrency limited")
156 157
 			p.eventStream.Send(p.ctx, NewEventConcurrencyLimited())
157 158
 		}

Loading…
Откажи
Сачувај