Merge PR #1035: release per-download status_queue proxy on close to fix fd leak (#485)

Wraps Download.close() in try/finally and nulls self.status_queue so the
per-download manager.Queue() proxy is released once the completed Download is
retained in the done list. Previously every finished download permanently
pinned one Manager-process connection, accumulating file descriptors until
the instance hit 'too many open files' and self-terminated (#485, #980).

Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
This commit is contained in:
Alex Shnitman
2026-07-24 11:44:47 +03:00
2 changed files with 39 additions and 2 deletions
+5 -2
View File
@@ -787,8 +787,11 @@ class Download:
def close(self):
log.info(f"Closing download process for: {self.info.title}")
if self.started():
self.proc.close()
try:
if self.started():
self.proc.close()
finally:
self.status_queue = None
def running(self):
try: