Переглянути джерело

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
 		}

Завантаження…
Відмінити
Зберегти