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

Hangs on Connection root #369

Closed
bantzi opened this issue Jan 27, 2020 · 2 comments
Closed

Hangs on Connection root #369

bantzi opened this issue Jan 27, 2020 · 2 comments

Comments

@bantzi
Copy link

bantzi commented Jan 27, 2020

after updating to version 4.1.3
currently it appears to hang when calling Connection "root" property.
it gets stuck within the wait() function (root >> sync_request >> value >> wait)
it appears that result never arrives
perhaps the _send function is not able to acquire the lock and send the message...

before updating to the new version it worked on version 4.1.2, I have updated to the new version because it solved previous issue #365 (key error)

sample code
        self.conn = unix_connect(socket_str,
                                 config={'allow_pickle': True,
                                         'allow_all_attrs': True,
                                         "sync_request_timeout": None})

        self.conn_root = self.conn.root --> hangs
Environment
  • rpyc 4.1.3
  • python 2.7.10
  • operating MacOs
@bantzi
Copy link
Author

bantzi commented Jan 27, 2020

the following code simulates the problem
looking onto it, I found it to be very weird since the problem occurs only when importing MyService class.
(when MyService class is on the same file --> it doesn't gets hang)

--------------------- example.py -----------------

import os

from tests.rpyc.MyService import MyService


if __name__ == "__main__":
    from rpyc.utils.server import ThreadedServer

    session_path = '/tmp/session'
    if os.path.exists(session_path):
        os.remove(session_path)
    tserver = ThreadedServer(MyService,
                             socket_path=session_path,
                             protocol_config={"allow_all_attrs": True,
                                              "allow_setattr": True,
                                              "allow_pickle": True,
                                              "listener_timeout": None})
    tserver.listener.settimeout(0.5)
    tserver.start()

------------------------ MyService.py -----------------

import rpyc


class MyService(rpyc.Service):

    def on_connect(self, conn):
        # code that runs when a connection is created
        # (to init the service, if needed)
        pass

    def on_disconnect(self, conn):
        # code that runs after the connection has already closed
        # (to finalize the service, if needed)
        pass

    def exposed_get_answer(self):  # this is an exposed method
        return 42

    exposed_the_real_answer_though = 43  # an exposed attribute

    def get_question(self):  # while this method is not exposed
        return "what is the airspeed velocity of an unladen swallow?"

@comrumino
Copy link
Collaborator

Thanks for reporting!

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

2 participants