Avoid EOFError in parallel builds#14459
Open
JonathonReinhart wants to merge 4 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This hopefully avoids all all possible "
EOFErrorwhen 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:
logging.convert_serializable()is updated to avoid two places where exceptions could be raised. If an exception is raised, theLogRecordis updated to convey that information.logging.convert_serializable()is wrapped intry/exceptjust in case 1. was (or becomes) insufficient.pipe.send()is itself wrapped in atry/exceptin 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 --
EOFErrorwas never raised.References
logging.convert_serializable#14458This probably fixes other previous issues:
While other fixes have resolved the underlying exceptions, they have not addressed the
EOFErroritself.