Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Connection logic improvements #87

Merged
merged 5 commits into from
Oct 1, 2015
Merged

Connection logic improvements #87

merged 5 commits into from
Oct 1, 2015

Conversation

horkhe
Copy link
Contributor

@horkhe horkhe commented Sep 29, 2015

This PR brings several improvements and fixes that we made in the connection object implementation to address issues that had been discovered while running the library in production. They are as follows:

  • recvTimeout, pingTimeout derive from session timeout and therefore should be recalculated if a new sessionTimeout value is negotiated;
  • make logging of the connection life cycle state transitions a bit more verbose to facilitate connection issue debugging;
  • watches should be restored on successful authentication only;
  • the server connection string reported in connecting event was incorrect;
  • session information should not be discarded on connection errors. It is better to spin in the connect/disconnect loop until ZooKeeper cluster recovers then to drop a legit session data.

If you think that these changes should be separated into different commits then let me know. Although some of them just one liners, and the majority of changes were made to write NoQuorum test anyways.

c.lastZxid = 0
c.setState(StateExpired)
return ErrSessionExpired
return err
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was due to some weirdness in ZooKeeper where it would kill the client with no response if an invalid session ID was sent. This caused an infinite loop of reconnects.

I agree that not killing the session on an I/O error is technically correct though.. just depends on if ZooKeeper still exhibits that behavior.

@samuel
Copy link
Owner

samuel commented Oct 1, 2015

Thanks for the changes. Looks great.. especially having more tests

samuel added a commit that referenced this pull request Oct 1, 2015
Connection logic improvements
@samuel samuel merged commit 5f85ef9 into samuel:master Oct 1, 2015
@horkhe
Copy link
Contributor Author

horkhe commented Oct 1, 2015

@samuel that was fast! Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants