Skip to content

Fix ConjureHTTPError pickling crash in multiprocessing#178

Draft
matthewbayer wants to merge 1 commit intodevelopfrom
mb/fix-conjure-http-error-pickle
Draft

Fix ConjureHTTPError pickling crash in multiprocessing#178
matthewbayer wants to merge 1 commit intodevelopfrom
mb/fix-conjure-http-error-pickle

Conversation

@matthewbayer
Copy link

Before this PR

PR #167 fixed a copy.copy() crash on ConjureHTTPError by adding a __copy__ override, but the same underlying issue also affects pickling. BaseException.__reduce__ produces pickle instructions that call ConjureHTTPError.__init__(message_string), passing the string message as the http_error argument. Since __init__ expects an HTTPError object with a .response attribute, this crashes with AttributeError: 'str' object has no attribute 'response'.

This surfaces when a ConjureHTTPError is raised inside a ProcessPoolExecutor worker — the pool tries to pickle the exception to send it back to the parent process, the unpickle fails, and the worker crashes with BrokenProcessPool.

After this PR

ConjureHTTPError can be safely pickled and unpickled. This unblocks use of ProcessPoolExecutor (and any other pickle-based serialization) with code that may raise ConjureHTTPError.

==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.

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>
@changelog-app
Copy link

changelog-app bot commented Feb 26, 2026

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Fix ConjureHTTPError pickling crash in multiprocessing

Override __reduce__ to bypass __init__ on reconstruction, matching the existing __copy__ fix from #167.

Check the box to generate changelog(s)

  • Generate changelog entry

@changelog-app
Copy link

changelog-app bot commented Feb 26, 2026

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

🐛 Fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants