Skip to content

Conversation

@gpauloski
Copy link
Collaborator

Description

If a proxy is resolved and it's deserializer raises an AttributeError, the proxy raises a vague AttributeError: __wrapped__.

For example, this code raises the following stacktrace.

from proxystore.store import Store
from proxystore.connectors.local import LocalConnector

def deserialize(obj: bytes):
    raise AttributeError()

with Store('test', LocalConnector()) as store:
    x = store.proxy([1, 2, 3], deserializer=deserialize)
    print(x)
Traceback (most recent call last):
  File "/home/jgpaul/workspace/proxystore/t.py", line 9, in <module>
    print(x)
  File "/home/jgpaul/workspace/proxystore/venv/lib/python3.11/site-packages/lazy_object_proxy/slots.py", line 143, in __str__
    return str(self.__wrapped__)
               ^^^^^^^^^^^^^^^^
  File "/home/jgpaul/workspace/proxystore/venv/lib/python3.11/site-packages/lazy_object_proxy/slots.py", line 210, in __getattr__
    raise AttributeError(name)
AttributeError: __wrapped__

This PR improve serialization handling to:

  • Catch pickle/cloudpickle errors and raise them as SerializationError
  • Catch deserialize errors in Store.get()

I wanted to be able to log the deserializer used that caused the issues. This required changing get_class_path to support more than classes, so I changed it to support arbitrary objects.

Fixes

Type of Change

  • Breaking Change (fix or enhancement which changes existing semantics of the public interface)
  • Enhancement (new features or improvements to existing functionality)
  • Bug (fixes for a bug or issue)
  • Internal (refactoring, style changes, testing, optimizations)
  • Documentation update (changes to documentation or examples)
  • Package (dependencies, versions, package metadata)
  • Development (CI workflows, pre-commit, linters, templates)
  • Security (security related changes)

Testing

Added unit tests.

Pull Request Checklist

Please confirm the PR meets the following requirements.

  • Tags added to PR (e.g., breaking, bug, enhancement, internal, documentation, package, development, security).
  • Code changes pass pre-commit (e.g., mypy, ruff, etc.).
  • Tests have been added to show the fix is effective or that the new feature works.
  • New and existing unit tests pass locally with the changes.
  • Docs have been updated and reviewed if relevant.

@gpauloski gpauloski added the bug Error, flaw, or fault that causes unexpected behavior label Apr 4, 2024
@gpauloski gpauloski merged commit 1cf46b0 into main Apr 4, 2024
@gpauloski gpauloski deleted the issue-530 branch April 4, 2024 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Error, flaw, or fault that causes unexpected behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serialization failure in proxy resolve propagates as AttributeError: __wrapped__

2 participants