ocrmypdf/OCRmyPDF · critical · InputFileError
A worker process lost access to an input file
Error message
A worker process lost access to an input file
What it means
This is the semaphore-free executor plugin's (extra_plugins.semfree) copy of the SIGBUS worker handler: it raises InputFileError when a worker process receives SIGBUS, meaning a mapped/open input or temp file vanished or its storage failed mid-run.
Source
Thrown at src/ocrmypdf/extra_plugins/semfree.py:67
result = auto() # pylint: disable=invalid-name
complete = auto() # pylint: disable=invalid-name
def split_every(n: int, iterable: Iterable) -> Iterator:
"""Split iterable into groups of n.
>>> list(split_every(4, range(10)))
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
https://stackoverflow.com/a/22919323
"""
iterator = iter(iterable)
return takewhile(bool, (list(islice(iterator, n)) for _ in repeat(None)))
def process_sigbus(*args):
"""Handle SIGBUS signal at the worker level."""
raise InputFileError("A worker process lost access to an input file")
class ConnectionLogHandler(logging.handlers.QueueHandler):
"""Handler used by child processes to forward log messages to parent."""
def __init__(self, conn: Connection) -> None:
"""Initialize the handler."""
# sets the parent's queue to None - parent only touches queue
# in enqueue() which we override
super().__init__(None) # type: ignore
self.conn = conn
def enqueue(self, record):
"""Enqueue a log message."""
self.conn.send(('log', record))
def process_loop(View on GitHub (pinned to 5074a0b0e1)
Solutions
- Free space on TMPDIR/output filesystems and retry.
- Keep inputs on stable local storage and prevent concurrent deletion/cleanup during the job.
- Set TMPDIR to a disk-backed path with enough room.
Defensive patterns
Strategy: retry
Validate before calling
import shutil, os
assert shutil.disk_usage(os.environ.get('TMPDIR','/tmp')).free > 1_000_000_000 Try / catch
from ocrmypdf.exceptions import InputFileError
try:
run_with_semfree(...)
except InputFileError:
stabilize_storage(); retry_job() Prevention
- Guard TMPDIR free space with a preflight check.
- Avoid network-mounted inputs with the semfree executor.
When it happens
Trigger: Using the semfree concurrency plugin when an input/temp file is truncated or deleted during processing, or when the filesystem backing it (disk, tmpfs, network mount) errors.
Common situations: Same as the builtin pool: tmpfs filling up, aggressive tmp cleaners, or unstable network-mounted inputs, plus choosing semfree for very high page counts.
Related errors
- A worker process lost access to an input file
- --redo-ocr (or --mode redo) is not currently compatible with
- Since you specified `--output-type none`, the output file {s
- Input file is an image, but the resolution (DPI) is not cred
- Input file is an image, but has no resolution (DPI) in its m
AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27).
Data as JSON: /api/errors/76f509893f57be7f.
Report an issue: GitHub.