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

rpyc not working on py-3.12.1 #550

Open
catchthemonster opened this issue Jan 30, 2024 · 4 comments
Open

rpyc not working on py-3.12.1 #550

catchthemonster opened this issue Jan 30, 2024 · 4 comments
Assignees
Labels
Triage Investigation by a maintainer has started

Comments

@catchthemonster
Copy link

So client will connect fine to server side (both running with same enterpeter (3.12.1), both bootstrap just fine...
when using exposed method and passing callback method and dictionary
protocol.py in _dispatch_request will throw errors starting with:
args = self._unbox(args)
finally getting:
RecursionError: maximum recursion depth exceeded ...

Does anyone has idea when will rpyc will support latest python ...

@comrumino
Copy link
Collaborator

comrumino commented Feb 5, 2024

RPyC 5.3.1 seem to work with the currently defined unittests on master for Python 3.12.1, but there are known issues I'm working on the develop branch. Would you be able more details to help reproduce your issue such as provide an example client/server or a failing unittest?

@comrumino comrumino self-assigned this Feb 5, 2024
@comrumino comrumino added the Triage Investigation by a maintainer has started label Feb 5, 2024
@catchthemonster
Copy link
Author

I think that I was doing something wrong. Do to architecture change I was trying to chain service with rpc client to another rpc service thus creating this type of recursion.
I redesigned architecture of app and refactored the code, so honestly I don't think that old code will help. I will in day or two run framework with client in 3.12.1 and let you know.
It would be nice to know if you don't mind what is that you folks are working one in dev ... If I run into this again I will post here ...

@catchthemonster
Copy link
Author

Hello,
I am confirming now that something is really deadly wrong with RPyC 5.3.1 and py-3.12.1
let me try to describe how our framework works:
py-3.12.1

main app will instantiate all sub-apps via multiprocessing. rpc threaded server is one of does apps. client in this case is part of another vertical stack FASTAPI (mix of sync and async behaviors) and number of metaclass structures representing one or the other software patterns. All of this is tied up with our code so everything works up to invocation of exposed method on rpc threaded server. rpc get's stuck on the protocol side, recursion error pops out and we fail. Now I tested it with py-3.11 and py-3.10.8. Both of these interpreters do a perfect job and no issues were detected.

@Property

def root(self):  # serving

    """Fetches the root object (service) of the other party"""

    if self._remote_root is None:

        self._remote_root = self.sync_request(consts.HANDLE_GETROOT)

    return self._remote_root



def sync_request(self, handler, *args):

    """requests, sends a synchronous request (waits for the reply to arrive)



    :raises: any exception that the requets may be generated

    :returns: the result of the request

    """

    timeout = self._config["sync_request_timeout"]

    _async_res = self.async_request(handler, *args, timeout=timeout)

    # _async_res is an instance of AsyncResult, the value property invokes Connection.serve via AsyncResult.wait

    # So, the _recvlock can be acquired multiple times by the owning thread and warrants the use of RLock

    return _async_res.value

some of the traceback...

2024-02-07 16:58:37,739 - INFO - 1680823 - server.py:200 server:_serve_client - welcome ('10.197.136.73', 53908)

2024-02-07 16:59:09,841 - DEBUG - 1680823 - protocol.py:366 protocol:_dispatch_request - Exception caught

Traceback (most recent call last):

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 358, in _dispatch_request

args = self._unbox(args)

       ^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 324, in _unbox

return tuple(self._unbox(item) for item in value)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 324, in

return tuple(self._unbox(item) for item in value)

             ^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 333, in _unbox

proxy = self._netref_factory(id_pack)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 353, in _netref_factory

return cls(self, id_pack)

       ^^^^^^^^^^^^^^^^^^

File "/data1/kacans2/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing.py", line 498, in call

frame = self.frame

        ^^^^^^^^^^

File "/data1/kacans2/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing.py", line 41, in frame

while frame and isinstance(frame.f_locals.get('self'), PEP669CallbackBase):

                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/netref.py", line 133, in getattribute

cls = object.__getattribute__(self, "__class__")

      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/netref.py", line 291, in get

return self.owner if netref_instance.____id_pack__[2] == 0 else self.instance

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/netref.py", line 153, in getattr

return syncreq(self, consts.HANDLE_GETATTR, name)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/netref.py", line 63, in syncreq

return conn.sync_request(handler, proxy, *args)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 715, in sync_request

_async_res = self.async_request(handler, *args, timeout=timeout)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 742, in async_request

self._async_request(handler, args, res)

File "/cube/api/py-3.12.1/lib/python3.12/site-packages/rpyc/core/protocol.py", line 724, in _async_request

self._send(consts.MSG_REQUEST, seq, (handler, self._box(args)))

                                              ^^^^^^^^^^^^^^^

Regards,

@catchthemonster
Copy link
Author

Hello,
Is there anything else wee can do on this issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage Investigation by a maintainer has started
Projects
None yet
Development

No branches or pull requests

2 participants