3 ms·
> Like I can guarantee there are tons of CLOSE_WAIT connections on my near-idle Python process for various of db pools, mysql or redis or pg. Generally your c
by outworlder 6y ago
> Like I can guarantee there are tons of CLOSE_WAIT connections on my near-idle Python process for various of db pools, mysql or redis or pg.
Generally your client should close the connection when it's done. Server-side close should mostly be related to idle timeouts.
- est 6y ago> Generally your client should close the connection when it's done. Server-side close should mostly be related to idle timeouts. To achieve that, the client must have an extra thread listening for the close event, or a periodic check to purge the dead TCP connections. But there's a gotcha, some TCP connections without KEEPALIVE just timeout naturally, and FIN packets may never reach the client, you only know the connections is dead when you initiate a real request. This is when most connection pool fail apart.