kragniz / kragniz/python-etcd3

Python-etcd3 watch timeout or hang forever if token expired

Open
#1,227 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
450
Forks
194
PR merge metrics
No merged PRs in 30d

Description

Hi,anyone meet the same problem?
I use python-etcd3 in our project, mainly use watch function and found if there are frequently interacting between client<->server,which keeps the user token works well,then the watch function works well, but if there is no any interacting between client and server for specific time(for example 5minutes),that leads server delete client‘s token,after then client continue to watch a new key, then in python-etcd3 it would hang forever and no any reply or exception throw,or throw watch timeout exception if timeout is set,and after that all new watch would failed, and old watch also not work well,but for our online program,the token expired could be happen, once it happend as all new/old watch would not work, it would be a big problem. so any one know how to fix it or have some correspoinding resolve methods? It can be reproduce easily as below:
1. first create etcd client
2. after five minutes watch a key and it would hang forever or timeout
And i read the etcd code and think it has been blocked here waiting for response iterator:
def _run(self):
143 while True:
145 response_iter = self._watch_stub.Watch(
146 _new_request_iter(self._request_queue),
147 credentials=self._credentials,
148 metadata=self._metadata)
154 try:
155 for rs in response_iter:
157 self._handle_response(rs)
Any one know how to fix that?

Contributor guide

Open the contributing guide

Research direction

Start with the _run method and its _watch_stub.Watch response iterator, especially the credential and metadata handling shown in the report. Reproduce the five-minute idle period before watching a key, then verify that an expired token does not leave the watch blocked and that subsequent and existing watches remain usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.