Skip to content

fix(foundation): extracting from a pipe or non-seekable stream silently stops early (870 of 1,117 frames) #1586

Closed

Description

@JarryShaw

Reading a capture from a pipe or other non-seekable stream drops frames without a warning. The default engine stops partway through.

Repro on main (e9f3340f7), using examples/captures/http.pcap (1,117 frames):

  • extract(fin='…/http.pcap') reads 1,117 frames.
  • cat http.pcap | python -c "…extract(fin=sys.stdin.buffer, nofile=True)…" reads 870, both with and without no_eof=True.
  • An os.pipe() written in 4,096-octet chunks also reads 870.
  • A non-seekable io.RawIOBase that returns short reads also reads 870, both raw and wrapped in BufferedReader.

This is the input pcapkit - (stdin) relies on: __main__ sets no_eof exactly for that case.

Likely cause, not yet traced: a short read() from a pipe returns fewer octets than requested, and something treats that as end of file. A pipe may return less than requested at any point. The #1569 review saw the default engine read only 56 of 1,117 frames with a different chunking, so the cut-off depends on chunk boundaries.

Expected: every frame is read from a non-seekable stream, the same as from a path. A short read must not end the capture.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    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
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 10, 2026
  2. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 10, 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

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions