Skip to content

FIX: Close file handles to prevent descriptor leaks in CI and media parser#1069

Merged
canihavesomecoffee merged 1 commit intoCCExtractor:masterfrom
DhanushVarma-2:fix/file-handle-leaks
Mar 19, 2026
Merged

FIX: Close file handles to prevent descriptor leaks in CI and media parser#1069
canihavesomecoffee merged 1 commit intoCCExtractor:masterfrom
DhanushVarma-2:fix/file-handle-leaks

Conversation

@DhanushVarma-2
Copy link

@DhanushVarma-2 DhanushVarma-2 commented Mar 18, 2026

5 places used open().read() without closing the file handle, leaking file descriptors.
In long-running CI processes, this can exhaust the OS file descriptor limit.

Changes:

  • mod_ci/controllers.py: 4 open().read() calls for startup scripts, service account,
    and rclone config replaced with with open() as f: f.read()
  • mod_sample/media_info_parser.py: subprocess output handle wrapped in with statement
    so it closes after mediainfo completes

Replace open().read() with with-statement context managers in
mod_ci/controllers.py (4 instances) and mod_sample/media_info_parser.py
(1 instance) to prevent file descriptor leaks.
@sonarqubecloud
Copy link

@canihavesomecoffee canihavesomecoffee merged commit 8e4f6f8 into CCExtractor:master Mar 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants