Skip to content

Fix unpicklable Boost.Python exceptions crashing ZMQ server (ESROGUE-723)#1170

Merged
ruck314 merged 4 commits into
pre-releasefrom
ESROGUE-723
Apr 7, 2026
Merged

Fix unpicklable Boost.Python exceptions crashing ZMQ server (ESROGUE-723)#1170
ruck314 merged 4 commits into
pre-releasefrom
ESROGUE-723

Conversation

@ruck314

@ruck314 ruck314 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When a Boost.Python.ArgumentError is raised during a ZMQ remote procedure call, pickle.dumps() fails because Boost.Python exceptions cannot be serialized, crashing the server
  • Added a fallback in ZmqServer._doRequest() that converts unpicklable exceptions to a standard Exception preserving the full type name and message
  • Added regression test simulating an unpicklable exception to prevent future regressions

Test plan

  • New unit test verifies unpicklable exceptions are gracefully handled
  • Verified fix works with real Boost.Python.ArgumentError in local build
  • All existing tests pass (180/180)
  • flake8 linter clean

Resolves ESROGUE-723

When a Boost.Python.ArgumentError is raised during a ZMQ remote
procedure call, pickle.dumps() fails because Boost.Python exceptions
cannot be serialized. This causes the server to crash instead of
returning the error to the client.

Add a fallback that converts unpicklable exceptions to a standard
Exception preserving the full type name and message. Add regression
test for this corner case.

Resolves ESROGUE-723
@ruck314 ruck314 changed the title Fix unpicklable Boost.Python exceptions crashing ZMQ server Fix unpicklable Boost.Python exceptions crashing ZMQ server (ESROGUE-723) Apr 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the ZMQ RPC server against exceptions that cannot be pickled (notably Boost.Python exceptions), preventing server crashes by returning a safely-serializable fallback Exception and adding a regression test.

Changes:

  • Add a fallback in ZmqServer._doRequest() to wrap unpicklable exceptions into a plain Exception with a descriptive type+message string.
  • Add a unit test that simulates an unpicklable exception during an RPC call and verifies the server responds without crashing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
python/pyrogue/interfaces/_ZmqServer.py Adds nested exception-pickling fallback to avoid crashing when an exception isn’t serializable.
tests/interfaces/test_interfaces_zmq_server.py Adds regression coverage for the unpicklable-exception path in _doRequest().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/pyrogue/interfaces/_ZmqServer.py Outdated
Comment thread tests/interfaces/test_interfaces_zmq_server.py Outdated
Use getattr(exc_type, "__qualname__", exc_type.__name__) when converting
unpicklable exceptions to preserve fully-qualified type names (e.g.
nested classes). Also strengthen the regression test to assert the exact
Exception type and verify the original exception type name appears in
the converted message.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/pyrogue/interfaces/_ZmqServer.py
Comment thread tests/interfaces/test_interfaces_zmq_server.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/interfaces/test_interfaces_zmq_server.py
Override __reduce__ to raise PicklingError instead of relying on
Boost.Python being non-importable in the test environment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ruck314 ruck314 merged commit fa1f345 into pre-release Apr 7, 2026
11 checks passed
@ruck314 ruck314 deleted the ESROGUE-723 branch April 7, 2026 22:22
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.

3 participants