redis-rdb-tools icon indicating copy to clipboard operation
redis-rdb-tools copied to clipboard

ValueError: year is out of range (memory report)

Open jessereynolds opened this issue 10 years ago • 3 comments

Attempting a memory report on our redis dump files fails as per below

$ sudo rdb -c memory dump.rdb.pre-purge > rdb_memory.csv
Traceback (most recent call last):
  File "/usr/local/bin/rdb", line 9, in <module>
    load_entry_point('rdbtools==0.1.6', 'console_scripts', 'rdb')()
  File "/usr/local/lib/python2.7/dist-packages/rdbtools/cli/rdb.py", line 82, in main
    parser.parse(dump_file)
  File "/usr/local/lib/python2.7/dist-packages/rdbtools/parser.py", line 284, in parse
    self._expiry = to_datetime(read_unsigned_long(f) * 1000)
  File "/usr/local/lib/python2.7/dist-packages/rdbtools/parser.py", line 705, in to_datetime
    dt = datetime.datetime.utcfromtimestamp(seconds_since_epoch)
ValueError: year is out of range

jessereynolds avatar May 27 '15 13:05 jessereynolds

@oranagra can you look into this or merge these changes ?

sharmaansh21 avatar Jan 20 '17 17:01 sharmaansh21

The above referenced commit has lots of noise in it, as far as I could understand, it only comment out the content of to_datetime() and directly return the argument value . While this can solve problems with the commented code, it doesn't serve the original purpose.

utcfromtimestamp() raise this ValueError when the timestamp is of a year out of the platform supported range. 3470263b725ce651894f1331bed8133f261a42fc fix some integer issues, also in the relevant code. It might worth a try to use the master branch code. Anyway, I think the right approach will be to catch this exception and truncate the value while printing a warning.

amotzg avatar Jan 28 '17 12:01 amotzg

@optimisticanshul i understand you can reproduce this problem, can you please try the code of the latest master to see if it solves it, and if not either try to implement what @amotzg suggested (catching the exception and logging the problem silently), or tell us how to reproduce. thanks.

oranagra avatar Jan 29 '17 09:01 oranagra