Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with get_id_pack, get_methods, a race and stdin, stdout issues #558

Closed
rlehfeld opened this issue Jun 15, 2024 · 0 comments
Closed

Comments

@rlehfeld
Copy link
Contributor

Describe the issue briefly here, including:

  • expected result versus actual result
    When working on a new Remote Library for Robot Framework (https://github.com/rlehfeld/robotframework-rpycremote) which takes the RPyC functionality into use, I run into several issues and also fixed them on my fork of RPyC. These changes I would like to describe but and if I remember right, I found 4 issues and unfortunately only one has a simple example which I will describe below.
  1. for objects which do not provide a class property, RPyC is not usable. E.g. this is the case for some c-extensions or when it is hidden. (for this problem I will provide a simple example)
    Here the problem is within rpyc.lib.get_id_pack
  2. When using Pydantic BaseModel objects, under some not completely understood cicumstances, the rpyc.lib.get_methods fails
  3. There is a race in rpyc.core.protocol.Connection._unbox between the lines:
            if id_pack in self._proxy_cache:
                proxy = self._proxy_cache[id_pack]

as the garbage collector can and will kick in in between these two lines.
4. While fixing 3. and executing the unit tests I run into the following unrelated issue.
PipeStream and Win32PipeStream are taking ownership of stdin and stdout if from_std is used. When e.g. peer is closing the connection, the stdin and stdout of the python process is closed which can lead to exit code 1.

Further, I would like to say thank you for this super solution. Together with my Robot Framework Remote Library, this is a game changer.

Many thanks

René

Environment
  • rpyc version
    pypy3.10-7.3.15-2.3.10.fc40.x86_64
  • python version
    pypy3.10-7.3.15-2.3.10.fc40.x86_64
    python3-3.12.2-2.fc40.x86_64
  • operating system
    Fedora 40
Minimal example for problem 1

Server:
Objects from Dummy class below, cannot be used together with RPyC.

    class Dummy:
        """dummy class"""
        def __init__(self):
            self._value = 1
            self.value2 = 5

        def __getattribute__(self, attr):
            if attr in ('__class__'):
                raise AttributeError(f'catched {attr}')
            return super().__getattribute__(attr)

        @property
        def value(self):
            """value getter"""
            print('called value getter')
            return self._value

        @value.setter
        def value(self, v):
            print('called value setter')
            self._value = v

        def __call__(self, *args, **kwargs):
            """callable object"""
            print(f'called __call__({args}, {kwargs})')
            return '__call__'

        def method(self, *args, **kwargs):
            """and some callable method"""
            print(f'called method({args}, {kwargs})')
            return 'method'
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

No branches or pull requests

1 participant