nameko/nameko-grpc

ConnectionManager objects remain in pool after close

mattbennett opened this issue · 1 comments

This is a bug in 1.2.0rc and applies to the ServerConnectionPool and ClientConnectionPool introduced there.

When a ConnectionManager's run_forever method terminates, the connection is no longer considered "alive".

The ClientConnectionPool makes a determination about the health of a connection when one is requested, and discards any that are not "alive". In situations where a client connection regularly dies and is replaced by another one (e.g. a streaming pull where the server occasionally terminates), dead ClientConnectionManager objects can build up if the client is idle.

The ServerConnectionPool is worse, and keeps references to all ServerConnectionManager objects, never purging the dead ones. Dead ServerConnectionManager objects will build up in long-running servers which constitutes a slow memory leak.

Fixed by #42