Describe the bug

My redis server is running and then date -s change the time back to 1990. Then the mem_fragmentation_ratio is up to 1.85 and continue rising.

To reproduce

Run redis and then date -s back to 1990.

Expected behavior

Memory purge as normal.

Additional information

redis_version:6.2.11

Sam, I detected a few issues in this Redis instance memory implants:

  • High total RSS: This instance has a memory fragmentation and RSS overhead greater than 1.4 (this means that the Resident Set Size of the Redis process is much larger than the sum of the logical allocations Redis performed). This problem is usually due either to a large peak memory (check if there is a peak memory entry above in the report) or may result from a workload that causes the allocator to fragment memory a lot. If the problem is a large peak memory, then there is no issue. Otherwise, make sure you are using the Jemalloc allocator and not the default libc malloc. Note: The currently used allocator is "jemalloc-5.1.0".

  • High allocator RSS overhead: This instance has an RSS memory overhead is greater than 1.1 (this means that the Resident Set Size of the allocator is much larger than the sum what the allocator actually holds). This problem is usually due to a large peak memory (check if there is a peak memory entry above in the report), you can try the MEMORY PURGE command to reclaim it.

Comment From: sundb

You've taken a 2023 redis instance back to 1990, and it thinks it's still in 2023, so it's crazy. Not only redis, but any other tasks that rely on computer clock (not monotonic clock) will be affected.

Comment From: copyandrun

But the redis server is using the monotonic clock.

Comment From: copyandrun

You've taken a 2023 redis instance back to 1990, and it thinks it's still in 2023, so it's crazy. Not only redis, but any other tasks that rely on computer clock (not monotonic clock) will be affected.

But the redis server is using the monotonic clock.

Comment From: sundb

@copyandrun Not all, the reason why the defrag didn't work is that the corn in Redis using ustime().

Comment From: copyandrun

@copyandrun Not all, the reason why the defrag didn't work is that the corn in Redis using ustime().

Thanks. I got it. But why not change to monotonic clock?

Comment From: sundb

@copyandrun Now some ustime() may be able to use monotonic clocks, but some can't, such as expire command which needs precise timestamps.

Comment From: copyandrun

@copyandrun Now some ustime() may be able to use monotonic clocks, but some can't, such as expire command which needs precise timestamps.

Thank you. i will just close this.