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

Improve error handling when reconnecting to ZooKeeper #515

Open
eliska-n opened this issue Nov 10, 2023 · 1 comment
Open

Improve error handling when reconnecting to ZooKeeper #515

eliska-n opened this issue Nov 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@eliska-n
Copy link
Collaborator

Reconnecting to ZooKeeper works nicely, but it is quite "loud" in the logs.
There are uncaught exceptions propagated when ZooKeeper is not reachable.

Task exception was never retrieved
{'future': <Task finished name='Task-440' coro=<ZooKeeperContainer._readvertise() done, defined at /usr/local/lib/python3.11/dist-packages/asab/zookeeper/container.py:163> exception=SessionExpiredError()>}
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/asab/zookeeper/container.py", line 165, in _readvertise
    await adv._readvertise(self)
  File "/usr/local/lib/python3.11/dist-packages/asab/zookeeper/container.py", line 231, in _readvertise
    await zoocontainer.ZooKeeper.ProactorService.execute(check_at_zk)
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/asab/zookeeper/container.py", line 225, in check_at_zk
    if zoocontainer.ZooKeeper.Client.exists(self.RealPath):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/kazoo/client.py", line 1123, in exists
    return self.exists_async(path, watch=watch).get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/kazoo/handlers/utils.py", line 86, in get
    raise self._exception
kazoo.exceptions.SessionExpiredError
@ateska ateska added the enhancement New feature or request label Nov 10, 2023
@ateska
Copy link
Contributor

ateska commented Nov 11, 2023

This is a first step, addressing "Task exception was never retrieved".
The actual handling of the exception must be done in asab.zookeeper.container._readvertise() method.

#517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants