sripathikrishnan / redis-rdb-tools

Parse Redis dump.rdb files, Analyze Memory, and Export Data to JSON
https://rdbtools.com
MIT License
5.07k stars 739 forks source link

something wrong with the rdb parse #149

Open lincy991389662 opened 5 years ago

lincy991389662 commented 5 years ago

Hi, kindly please help check the parser problem, It seems the problem of rdb format, how can I cope with the source code?

redis_host.rdb.zip

oranagra commented 5 years ago

the file seems corrupted. the crash in redis-rdb-tools:

Traceback (most recent call last):
  File "rdbtools/cli/rdb.py", line 107, in <module>
    main()
  File "rdbtools/cli/rdb.py", line 101, in main
    parser.parse(dump_file)
  File "/home/oran/work/redis-rdb-tools/rdbtools/parser.py", line 394, in parse
    self.parse_fd(open(filename, "rb"))
  File "/home/oran/work/redis-rdb-tools/rdbtools/parser.py", line 461, in parse_fd
    self.read_object(f, data_type)
  File "/home/oran/work/redis-rdb-tools/rdbtools/parser.py", line 568, in read_object
    field = self.read_string(f)
  File "/home/oran/work/redis-rdb-tools/rdbtools/parser.py", line 510, in read_string
    raise Exception('read_string', "Invalid string encoding %s"%(length))
Exception: ('read_string', 'Invalid string encoding 56')

trying to load that file into redis:

33524:M 30 Dec 2018 13:00:11.790 # Internal error in RDB reading function at rdb.c:498 -> Unknown RDB string encoding type 56
[offset 0] Checking RDB file redis_host.rdb
[offset 27] AUX FIELD redis-ver = '4.0.10'
[offset 41] AUX FIELD redis-bits = '64'
[offset 53] AUX FIELD ctime = '1533828815'
[offset 84] AUX FIELD used-mem = '-6931009791549201400'
[offset 100] AUX FIELD aof-preamble = '0'
[offset 102] Selecting DB ID 0
--- RDB ERROR DETECTED ---
[offset 2304] Internal error in RDB reading function at rdb.c:498 -> Unknown RDB string encoding type 56
[additional info] While doing: read-object-value
[additional info] Reading key 'mom_test/demo/*l_kfx_05_44/*l_kfx_05_44'
[additional info] Reading type 4 (hash-hashtable)
[info] 12 keys read
[info] 0 expires
[info] 0 already expired

@lincy991389662 how did you generate that file? is it reproducible? it could be a bug in redis, or something else that corrupted that file after it was produced.