Details
-
Bug
-
Resolution: Fixed
-
Blocker
-
2.5.1
-
Security Level: Public
-
Triaged
-
No
Description
When you change the time of server to be a time in the pass when the memcached process is running it will start expiring all documents with TTL.
To recreate set date to a time in the past for example 2 hours ago from now.
sudo date --set="15:56:56"
You will see that time and uptime from cbstats will change to a large amount:
time: 5698679116
uptime: 4294946592
Looking at the code we can see how this happens:
http://src.couchbase.org/source/xref/2.5.1/memcached/daemon/memcached.c#6462
When you change the time to a value in the past "process_started" will be greater than "timer.tv_sec" and current_time is unsigned which means it will wrap around.
What I do not understand from the code is why current_time is the number of seconds since memcached started and not just the epoch time? (There is a comment about avoiding 64bit) .
http://src.couchbase.org/source/xref/2.5.1/memcached/daemon/memcached.c#117
Any case we should check if "process_started" is bigger than "timer.tv_sec" do something smart.
I will let you decide what the smart thing is