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

make client session timeout use monotonic clock #90

Closed
ongardie opened this Issue Feb 9, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@ongardie
Copy link
Member

ongardie commented Feb 9, 2015

Scale has a test where they mess with the system clock on the servers, and this needlessly PANICs clients with SESSION_EXPIRED errors. It'd be better to use a clock that ticks based on time passing on the leader but doesn't pretend to follow the Unix epoch.

@ongardie ongardie self-assigned this Feb 9, 2015

@ongardie

This comment has been minimized.

Copy link
Member

ongardie commented Feb 16, 2015

There's an added bonus to this: if the network is out entirely, time won't pass.

ongardie added a commit that referenced this issue Feb 20, 2015

Add cluster-wide clock
From the ClusterClock docs:

The cluster time approximately tracks how long the cluster has been
available with a working leader.

Cluster time is measured in nanoseconds and progresses at about the same
rate as a normal clock when the cluster is operational. While there's a
stable leader, the nanoseconds increase according to that leader's
SteadyClock. When a new leader takes over, it starts ticking from cluster
time value it finds in its last entry/snapshot, so some cluster time may be
unaccounted for between the last leader replicating its final entry and then
losing leadership.

The StateMachine uses cluster time to expire client sessions. Cluster times
in committed log entries monotonically increase, so the state machine will
see cluster times monotonically increase.

Before cluster time, client sessions were expired based on the SystemClock.
That meant that if the SystemClock jumped forwards drastically, all clients
would expire. That's undesirable, so cluster time was introduced in #90
("make client session timeout use monotonic clock") to address this.

Close #90: make client session timeout use monotonic clock
@ongardie

This comment has been minimized.

Copy link
Member

ongardie commented Feb 20, 2015

@nhardt, I think this is fixed in branch "issue-90". Can you run it through that regression test before I merge it into master?

@ongardie ongardie assigned ongardie and unassigned ongardie Feb 20, 2015

@ongardie

This comment has been minimized.

Copy link
Member

ongardie commented Feb 28, 2015

test passed, thanks @nhardt

@ongardie ongardie closed this Feb 28, 2015

@ongardie ongardie reopened this Feb 28, 2015

@ongardie ongardie closed this in e100f26 Feb 28, 2015

@nhardt

This comment has been minimized.

Copy link
Contributor

nhardt commented Feb 28, 2015

no problem, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment