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
Fix bug where kazoo client returns SESSION EXPIRED when in CONNECTING state #570
Conversation
|
Hi, Thanks for this PR, I will link into it. Don't bother with the tests for now, I will re-trigger the Travis build. |
|
Hey @StephenSorriaux, Just wanted to check on this. Does the change seem reasonable to you? |
|
Hey @prajay, I did not have time to go deep in the reason why we chose to raise |
|
Hi @StephenSorriaux, @prajay, A note to let you know that we are also seeing the issue addressed by this PR (also reported as The main issue is that spurious "session expired" exceptions can cause applications to tear down much more state than required, and to try to rebuild it—further stressing an ensemble which may just have, for example, lost its leader. I see that the goal of the commit (by @bbangert) which introduced the I basically see three ways of allowing applications to discriminate between these different states while retaining "full" backward compatibility:
Each of these options is "distasteful" in its own way, but I could nevertheless whip up patches/PRs for #3 and/or #2 if you think they would be worth a closer look. (#3 would probably be more "natural" if we manage to find "reasonable" subclass names. |
|
Hi @ztzg, Thanks for taking some time to share your thoughts about this subject. I understand what you want to do the and I start to think that the |
|
Not raising an exception on I had written it off as requiring invasive changes and/or going against the "philosophy" of Kazoo (no |
|
I really would like to more forward with this issue, so yes any contributions is very welcomed. |
|
Nudge @ztzg |
|
@jeffwidman: Still in my TODO list, but other things got on top. You're right that I should move forward a bit on this front, though. I'll keep your nudge in mind! :) |
…n-zk#374) As discussed in python-zk#570 (comment): * Requests issued in 'CONNECTING' state get queued, and a "token" added to the pipe, as in the 'CONNECTED' state; * All test pass; * TODO: This patch does not try to limit the maximum queue length. How should that be controlled? A new 'KazooClient' parameter? If so, what should it default to?
…n-zk#374) As discussed in python-zk#570 (comment): With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a (misleading) 'SessionExpiredError'. * [TODO] This patch does not prevent requests which have been queued but not emitted from being rejected with 'ConnectionLoss'. It should also get rid of the second part of '_notify_pending', shouldn't it? * [TODO] This patch does not try to limit the maximum queue length, which should probably be controlled via a new 'KazooClient' parameter. (How about 'max_queue_length'? What should it default to?)
…n-zk#374) As discussed in python-zk#570 (comment): With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a (misleading) 'SessionExpiredError'. * [TODO] This patch does not prevent requests which have been queued but not emitted from being rejected with 'ConnectionLoss'. It should also get rid of the second part of '_notify_pending', shouldn't it? * [TODO] This patch does not try to limit the maximum queue length, which should probably be controlled via a new 'KazooClient' parameter. (How about 'max_queue_length'? What should it default to?)
…#374) As discussed in python-zk#570 (comment): With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a (misleading) 'SessionExpiredError'.
…#374) With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a misleading 'SessionExpiredError'. This fixes python-zk#374, and brings Kazoo more in line with the Java and C clients. See the 'kazoo.client.KazooClient.state' documentation as well as these discussions for more details: python-zk#570 (comment) python-zk#583 (comment)
…#374) With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a misleading 'SessionExpiredError'. This fixes python-zk#374, and brings Kazoo more in line with the Java and C clients. See the 'kazoo.client.KazooClient.state' documentation as well as these discussions for more details: python-zk#570 (comment) python-zk#583 (comment)
With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a misleading 'SessionExpiredError'. This fixes #374, and brings Kazoo more in line with the Java and C clients. See the 'kazoo.client.KazooClient.state' documentation as well as these discussions for more details: #570 (comment) #583 (comment)

kazoo client returns a SessionExpired when its state is in CONNECTING. This is not an indication of session expiry and could just be that the client is still re-establishing a connection to the server after a network blip. Hence, the error returned should be a ConnectionLoss and not a SessionExpired