Skip to content

fix(foundation): close the engine too when the Extractor constructor raises after choosing one #2107

Closed

Description

@JarryShaw

Found while reviewing #2106. Extractor.__init__ assigns _exeng once the magic number is read. If _exeng.run(), _open_output() or record_frames raises after that, nothing calls _exeng.close(). #2106 closes the input the Extractor owns, but an engine's own resources stay open until garbage collection. For example, PyShark's _extmp capture keeps its temporary file and tshark process.

Proposed: in #2106's handler, also close the engine when one exists, for example with getattr(self, '_exeng', None). Do it without masking the original exception. Add a test that injects a raising engine and checks its close() ran. This depends on #2106 merging first.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 23, 2026
  2. moved this to Blocked in PyPCAPKiton Oct 23, 2026
  3. added
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 23, 2026
  4. moved this from Blocked to WIP in PyPCAPKiton Oct 23, 2026
  5. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 24, 2026
  6. added this to the PyPCAPKit v1.5 milestone on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions