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

EtcdWatchTimedOut does not been raised when occur #268

Open
TCGOGOGO opened this issue Oct 11, 2019 · 0 comments
Open

EtcdWatchTimedOut does not been raised when occur #268

TCGOGOGO opened this issue Oct 11, 2019 · 0 comments

Comments

@TCGOGOGO
Copy link
Contributor

TCGOGOGO commented Oct 11, 2019

EtcdWatchTimedOut seems raised in _wrap_request (client.py)

    def _wrap_request(payload):
        ...
                except (HTTPError, HTTPException, socket.error) as e:
                    if (isinstance(params, dict) and
                        params.get("wait") == "true" and
                        isinstance(e, ReadTimeoutError)):
                        _log.debug("Watch timed out.")
                        raise etcd.EtcdWatchTimedOut(
                            "Watch timed out: %r" % e,
                            cause=e
                        )

however, this exception will be catched internally in _acquired (lock.py)

    def _acquired(self, blocking=True, timeout=0):
        ...
            while True:
                try:
                    r = self.client.watch(watch_key, timeout=t, index=nearest.modifiedIndex + 1)
                    _log.debug("Detected variation for %s: %s", r.key, r.action)
                    return self._acquired(blocking=True, timeout=timeout)
                except etcd.EtcdKeyNotFound:
                    _log.debug("Key %s not present anymore, moving on", watch_key)
                    return self._acquired(blocking=True, timeout=timeout)
                except etcd.EtcdLockExpired as e:
                    raise e
          !!!   except etcd.EtcdException:
          !!!       _log.exception("Unexpected exception")

As a result, while loop will not break even if timeout occur. That's to say, timeout is useless

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

1 participant