Skip to content

Avoid EOFError in parallel builds#14459

Open
JonathonReinhart wants to merge 4 commits into
sphinx-doc:masterfrom
JonathonReinhart:parallel-eof
Open

Avoid EOFError in parallel builds#14459
JonathonReinhart wants to merge 4 commits into
sphinx-doc:masterfrom
JonathonReinhart:parallel-eof

Conversation

@JonathonReinhart
Copy link
Copy Markdown

@JonathonReinhart JonathonReinhart commented May 29, 2026

Purpose

This hopefully avoids all all possible "EOFError when running in parallel mode" issues. It does so by handling (hopefully) all possible uncaught exceptions in the multiprocessing child.

We address this at three layers:

  1. logging.convert_serializable() is updated to avoid two places where exceptions could be raised. If an exception is raised, the LogRecord is updated to convey that information.
  2. The call to logging.convert_serializable() is wrapped in try/except just in case 1. was (or becomes) insufficient.
  3. The call to pipe.send() is itself wrapped in a try/except in case there is anything in the logs (e.g. exc_info) which cannot be pickled.

Testing

AFAICT there is no facility for automated tests in this area of the code.

This was tested manually by raising exceptions in the locations mentioned above, and verifying that the exception was always displayed -- EOFError was never raised.

References

This probably fixes other previous issues:

While other fixes have resolved the underlying exceptions, they have not addressed the EOFError itself.

An exception here will cause the multiprocessing child to exit without
writing a result to the pipe, resulting in the parent seeing EOF.

Fixes sphinx-doc#14458
@JonathonReinhart JonathonReinhart marked this pull request as draft May 29, 2026 23:09
@JonathonReinhart JonathonReinhart changed the title Parallel eof Avoid EOFError in parallel builds May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EOFError in parallel builds due to logging.convert_serializable

2 participants