zookeeper-cpp
ZooKeeper Client for C++
|
The client session has been ended by the server. More...
#include <zk/error.hpp>
Additional Inherited Members | |
Public Member Functions inherited from zk::invalid_connection_state | |
invalid_connection_state (error_code code, const std::string &description) | |
Public Member Functions inherited from zk::error | |
error (error_code code, const std::string &description) | |
error_code | code () const |
The code representation of this error. More... | |
The client session has been ended by the server.
When this occurs, all ephemerals associated with the session are deleted and standing watches are cancelled.
This error is somewhat easy to confuse with connection_loss, as they commonly happen around the same time. The key difference is a session_expired is an explicit error delivered from the server, whereas connection_loss is a client-related notification. A connection_loss is usually followed by session_expired, but this is not guaranteed. If the client reconnects to a different server before the quorum removes the session, the connection can move back to state::connected without losing the session. The mechanism of resuming a session can happen even in cases of quorum loss, as session expiration requires a leader in order to proceed, so a client reconnecting soon enough after the ensemble forms quorum and elects a leader will resume the session, even if the quorum has been lost for days.