Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/7157.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed file handle leak when content app access triggers downloads due to on_demand or streamed policy.
6 changes: 6 additions & 0 deletions pulpcore/content/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,12 @@ async def finalize():
"on-demand-downloading/#on-demand-and-streamed-limitations>"
)

# manually close the DownloadFactory's (HTTP-)session, the next artifact-download will
# create a new DownloadFactory anyway because it will use a new remote-object.
# Leaving it open also left open file-descriptors to /dev/urandom. Most likely these FDs are
# held by the underlying SSL library.
await downloader.session.close()

if save_artifact and remote.policy != Remote.STREAMED:
content_artifacts = await asyncio.shield(
sync_to_async(self._save_artifact)(download_result, remote_artifact, request)
Expand Down