Fix ConjureHTTPError pickling crash in multiprocessing#178
Draft
matthewbayer wants to merge 1 commit intodevelopfrom
Draft
Fix ConjureHTTPError pickling crash in multiprocessing#178matthewbayer wants to merge 1 commit intodevelopfrom
matthewbayer wants to merge 1 commit intodevelopfrom
Conversation
BaseException.__reduce__ passes the string message to __init__ on unpickle, but ConjureHTTPError.__init__ expects an HTTPError object. This causes an AttributeError crash when a ConjureHTTPError propagates across a ProcessPoolExecutor boundary. Override __reduce__ to bypass __init__ on reconstruction, matching the existing __copy__ fix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generate changelog in
|
✅ Successfully generated changelog entry!Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 📋Changelog Preview🐛 Fixes
|
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.
Before this PR
PR #167 fixed a
copy.copy()crash onConjureHTTPErrorby adding a__copy__override, but the same underlying issue also affects pickling.BaseException.__reduce__produces pickle instructions that callConjureHTTPError.__init__(message_string), passing the string message as thehttp_errorargument. Since__init__expects anHTTPErrorobject with a.responseattribute, this crashes withAttributeError: 'str' object has no attribute 'response'.This surfaces when a
ConjureHTTPErroris raised inside aProcessPoolExecutorworker — the pool tries to pickle the exception to send it back to the parent process, the unpickle fails, and the worker crashes withBrokenProcessPool.After this PR
ConjureHTTPErrorcan be safely pickled and unpickled. This unblocks use ofProcessPoolExecutor(and any other pickle-based serialization) with code that may raiseConjureHTTPError.==COMMIT_MSG==
Fix ConjureHTTPError pickling crash in multiprocessing
Override
__reduce__to bypass__init__on reconstruction, matching the existing__copy__fix from #167.==COMMIT_MSG==
Possible downsides?
None. The current behavior (crashing on pickle) is a bug, not a contract. The public API, class hierarchy, and constructor signature are unchanged.