Skip to content

fix(parser): bare except Exception swallows MemoryError during per-page parse -- process continues in unstable state #295

Closed

Description

@piyushmakhija28

Summary

The per-page try/except in parser.py at line ~161 uses bare 'except Exception as exc:' which catches MemoryError (a subclass of Exception in Python). A corrupt page that causes a MemoryError is silently swallowed and logged as a page-skip warning, potentially allowing the pipeline to continue in an unstable memory state.

Fix

ingestion/parser.py line ~161: narrow the except to expected fitz error types:
except (fitz.FitzError, RuntimeError, AttributeError, ValueError) as exc:
And either let MemoryError propagate naturally, or re-raise after logging.

Impact

A large corrupt PDF page that causes OOM is silently skipped. The process may continue in a low-memory state causing unpredictable failures in subsequent processing.

Activity

  1. added
    bugSomething isn't working
    priority: lowMinor correctness or invariant violation
    code-reviewFound via automated code review
    on Jun 21, 2026
  2. piyushmakhija28 commented on Jun 21, 2026

    @piyushmakhija28
    ContributorAuthor

    Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)

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

    bugSomething isn't workingcode-reviewFound via automated code reviewpriority: lowMinor correctness or invariant violation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions