ARM-software / devlib

Library for interaction with and instrumentation of remote devices.
Apache License 2.0
47 stars 78 forks source link

atexit handler leaks connection instances #676

Closed douglas-raillard-arm closed 6 months ago

douglas-raillard-arm commented 6 months ago

While reviewing unrelated code, I realized we leak the connection objects when doing: https://github.com/ARM-software/devlib/blob/228baeb317a038b8e61a7d9c7710e6f13b0f7163/devlib/utils/ssh.py#L373

            atexit.register(self.close)

This should be fixable with a WeakMethod, and the callback used to call atexit.unregister()