0

CORE

The server part - Core, which is responsible for the registration of modules and the interaction between them. Core runs as ThreadedServer. CoreService provides registration modules. When registering I keep a list of Connections, then to use them. Module calls at the core function that it should call another module. But to use the list of connections does not work, the performance goes into an infinite loop.

class CoreService(rpyc.Service):
    __modules = {}
    def exposed_register_module(self, module_name):
        if module_name in self.__modules:
            return False
        self.__modules[module_name] = self._conn
        return True

    def exposed_execute_query_module(self, module_name, attribute_name, args):
        # TTTTTTTTTTHHHHHHHHHIIIIIIIISSSSSSSSSSSSSS
        if module_name in self.__modules:
             self.__modules[module_name].root
        # return None

Run test

When you run the test I get in into a loop which is interrupted by a combination of keys and get the following output:

^CTraceback (most recent call last):
File "/home/kpv/perseus/control-lib/perseus_control_lib/module.py", line 67, in __getattr__
        return self.__core_connector.root.execute_query_module(self.__proxy_module_name, name, args)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.py", line 196, in __call__
        return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.py", line 71, in syncreq
        return conn.sync_request(handler, oid, *args)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 438, in sync_request
        self.serve(0.1)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 387, in serve
        data = self._recv(timeout, wait_for_lock = True)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 344, in _recv
        if self._channel.poll(timeout):
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/channel.py", line 43, in poll
        return self.stream.poll(timeout)
File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 41, in poll
        rl, _, _ = select([self], [], [], timeout)
    KeyboardInterrupt
  • What does your test code look like? – David K. Hess Aug 31 '14 at 14:22
  • Pre-register module (associates a name with a Connection). Remotely calls exposed_execute_query_module (self, module_name, attribute_name, args). When checking, the Connection object exists, but it is impossible to refer to root. – Peter Kozhevnikov Aug 31 '14 at 14:47
  • Could you add that test code to your question? It would help. – David K. Hess Aug 31 '14 at 14:50
  • Yes, of course! I will provide the code completely. [Core](http://pastebin.com/1uR9k3UA) [Module](http://pastebin.com/EA4yNA0r) [Test](http://pastebin.com/Uq3ge95j) – Peter Kozhevnikov Aug 31 '14 at 14:55
  • 1
    My guess is that things are deadlocking on you due to running both modules and the server in the same process for your test. Try running them in three separate processes and see if it works. – David K. Hess Aug 31 '14 at 15:18
  • Hmm ... I did not even think. Thanks for the advice. I'll try to make as you suggest and certainly accomplish your goal. – Peter Kozhevnikov Aug 31 '14 at 15:23

0 Answers0