You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using redis version 2.4.4.
We are using debug object command to get lru_seconds_idle: in redis.
It worked properly without any issue untill system's time changed somehow to some future time.
The system's timestamp again came back to normal in 15-20 mins.
But after this redis is returning lru_seconds_idle:0 for all keys.
I agree with what you are saying. But shouldn't it recover from this once the time is again current time? I mean for those keys which inserted in future time it will give idle time 0, But for keys which inserted in current time it should return proper idle time value.
We accidentally changed the time of the system. I will try it with the latest 2.4 version and let you know.
The issue persist in Redis release 2.4.16.
My observations are:
Before changing the time, I inserted the object into redis. Its lru_seconds_idle time keeps on increasing as normal.
I changed system time to +1 day. The lru_seconds_idle is now increased to 86400 seconds(1 day) and it keeps on increasing normally.
I changed system time back to normal. Now for that key it is same as it was before. For newly inserted keys it is zero.
If system clock changed somehow then restarting redis is the only solution, till now. Even flushing database doesn't help in this situation. May be a command or something could be helpful that one can issue from redis-cli prompt to make it right.
Please comment on above issue.
Just looked into this issue and it turns out that this doesnot only impact the object's lru time.
When changing the system time back at step 3, redis is malfunctioning.
The timer event serverCron() will get called +1 day later after you change the system's time back, and some core functionality
of redis will stop working, like replication with master. After step 3, I sent SLAVEOF command to redis and
it did nothing:
[4989] 27 Aug 16:24:00 * SLAVE OF 127.0.0.1:6379 enabled (user request)
[4989] 27 Aug 16:24:10 * SLAVE OF 127.0.0.1:6380 enabled (user request)
[4989] 27 Aug 16:24:17 * SLAVE OF 127.0.0.1:6381 enabled (user request)
??? Nothing happened, the server didn't try to connect to the master.
I think this bug can be avoided by changing the impl of the timer.
Here's a temporary fix for this issue. It simply save the last time(second), and if current
time is before the saved time, the timer event is triggered regardless of it's timeout value.
Index: ae.c===================================================================---ae.c (revision482786)
+++ae.c (workingcopy)
@@ -54,6+54,8 @@
#endif#endif+/* Store the last time(in seconds) when a time event being executed */+staticlonglast_sec=0;
+aeEventLoop*aeCreateEventLoop(void) {
aeEventLoop*eventLoop;
inti;
@@ -235,7+237,8 @@
}
aeGetTime(&now_sec, &now_ms);
if (now_sec>te->when_sec||- (now_sec==te->when_sec&&now_ms >= te->when_ms))
+ (now_sec==te->when_sec&&now_ms >= te->when_ms) ||+now_sec<last_sec)
{
intretval;
@@ -261,6+264,8 @@
aeDeleteTimeEvent(eventLoop, id);
}
te=eventLoop->timeEventHead;
+/* Save current time */+last_sec=now_sec;
} else {
te=te->next;
}
@AnuragBerdia I think that @jokea's patch fixes this issue as well, as it resulted for the time event never being called to update the LRU clock. I'm merging the patch into 2.6 and unstable right now.
Activity
pietern commentedon Aug 16, 2012
Redis uses the system clock to estimate the idle time, so tampering with the clock will influence this.
Have you tried if this also happens with the latest 2.4 version, and the 2.6 release candidate?
AnuragBerdia commentedon Aug 17, 2012
Hi Pietern,
I agree with what you are saying. But shouldn't it recover from this once the time is again current time? I mean for those keys which inserted in future time it will give idle time 0, But for keys which inserted in current time it should return proper idle time value.
We accidentally changed the time of the system. I will try it with the latest 2.4 version and let you know.
AnuragBerdia commentedon Aug 20, 2012
The issue persist in Redis release 2.4.16.
My observations are:
If system clock changed somehow then restarting redis is the only solution, till now. Even flushing database doesn't help in this situation. May be a command or something could be helpful that one can issue from redis-cli prompt to make it right.
Please comment on above issue.
Thanks,
Anurag Berdia
AnuragBerdia commentedon Aug 23, 2012
Any updates on this? Can you please check this issue?
jokea commentedon Aug 27, 2012
Just looked into this issue and it turns out that this doesnot only impact the object's lru time.
When changing the system time back at step 3, redis is malfunctioning.
The timer event serverCron() will get called +1 day later after you change the system's time back, and some core functionality
of redis will stop working, like replication with master. After step 3, I sent SLAVEOF command to redis and
it did nothing:
[4989] 27 Aug 16:24:00 * SLAVE OF 127.0.0.1:6379 enabled (user request)
[4989] 27 Aug 16:24:10 * SLAVE OF 127.0.0.1:6380 enabled (user request)
[4989] 27 Aug 16:24:17 * SLAVE OF 127.0.0.1:6381 enabled (user request)
??? Nothing happened, the server didn't try to connect to the master.
I think this bug can be avoided by changing the impl of the timer.
jokea commentedon Aug 28, 2012
Here's a temporary fix for this issue. It simply save the last time(second), and if current
time is before the saved time, the timer event is triggered regardless of it's timeout value.
Fix for issue redis#633
Fix for issue redis#633
Force expire all timer events when system clock skew is detected.
antirez commentedon Oct 4, 2012
@AnuragBerdia I'm checking the issue you described today, news soon.
Force expire all timer events when system clock skew is detected.
antirez commentedon Oct 4, 2012
@AnuragBerdia I think that @jokea's patch fixes this issue as well, as it resulted for the time event never being called to update the LRU clock. I'm merging the patch into 2.6 and unstable right now.
Force expire all timer events when system clock skew is detected.
Force expire all timer events when system clock skew is detected.
antirez commentedon Oct 4, 2012
Patch merged, thank you. Closing this issue :-)
Adjust the log level of some logs in the cluster (redis#633)
Merge pull request redis#633 from t-mat/release-ci-badge
Adjust the log level of some logs in the cluster (redis#633)