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

Server doesn't unregister on close() when using auto_register=True #441

Closed
ghost opened this issue Mar 5, 2021 · 0 comments · Fixed by #445
Closed

Server doesn't unregister on close() when using auto_register=True #441

ghost opened this issue Mar 5, 2021 · 0 comments · Fixed by #445
Assignees
Labels
Done The issue discussion is exhausted and is closed w/ comment

Comments

@ghost
Copy link

ghost commented Mar 5, 2021

Hello,

I have a minimal setup with :

  • a server running with the parameters auto_register=True.
  • a basic client connecting by services, just to check the situation on the registry
  • running the basic service registry rpyc_registry.py without any options.

Steps to reproduce:

  • Run the server with python rpyc_test_serv.py
  • Run the registry with rpyc_registry.py
  • Send KeyboardInterrupt to the server to stop him.
  • Run the client once with python rpyc_test_cli.py

Expected result:
It should close properly and remove itself from the registry.
Client show : no servers exposing 'foo' were found

Actual result :
The server is still present in the registry.
Client shows : All services are down: (('XXX.XXX.X.XX', 44675),)

The problematic methods are close() and _register() .
When registering, _register() set self.auto_register to False.
But then close() use it to check if it should unregister or not. Since it has False as value, it skip unregistering.

Environment
  • rpyc version: 5.0.1
  • python version: 3.7.3
  • operating system: ubuntu 19.10
Minimal example

Server rpyc_test_serv.py :

import rpyc
from rpyc.utils.server import ThreadedServer


class HelloService(rpyc.Service):
    ALIASES = ["foo"]

    def exposed_bar(self):
        return "bar"


if __name__ == "__main__":
    rpyc.lib.setup_logger()
    server = ThreadedServer(HelloService, auto_register=True)
    server.start()

Client rpyc_test_cli.py:

import rpyc


if __name__ == "__main__":
    try:
        c = rpyc.connect_by_service("foo")
        print(c.root.bar())
    except Exception as err:
        print(f'Error occured : {err}')
@comrumino comrumino self-assigned this Mar 22, 2021
@comrumino comrumino added the To Start Description reviewed and a maintainer needs "to start" triage label Mar 22, 2021
@comrumino comrumino added Done The issue discussion is exhausted and is closed w/ comment and removed To Start Description reviewed and a maintainer needs "to start" triage labels May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Done The issue discussion is exhausted and is closed w/ comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant