dgraph-io / badger

Fast key-value DB in Go.
https://dgraph.io/badger
Apache License 2.0
13.73k stars 1.17k forks source link

panic: runtime error: slice bounds out of range [:2165545518] with capacity 158 #2065

Open ldapster opened 2 months ago

ldapster commented 2 months ago

Question.

Hi, older version of ipfs cluster (gcpm 3 pods) and one of the the pods is throwing the above error. Below is the stack trace:

goroutine 581 [running]:
github.com/dgraph-io/badger.(*valueLog).Read(0xc00040abf0, {0x2c6, 0x9e, 0x69513d0}, 0x54?)
    github.com/dgraph-io/badger@v1.6.2/value.go:1249 +0x44f
github.com/dgraph-io/badger.(*Item).yieldItemValue(0xc0029a2c60)
    github.com/dgraph-io/badger@v1.6.2/iterator.go:169 +0x13e

From looking at the 1.6/value.go source it appears that the header vlen value might be corrupted.
var h header
h.Decode(buf)
n := uint32(headerBufSize) + h.klen
return buf[n : n+h.vlen], cb, nil

The other two IPFS pods seem to be running fine. We are in a quandary on how to fix this node?
Is it possible to maybe backup and restore somehow from one of the other pods?
marius-enlock commented 2 months ago

Hi,

I also randomly ran in my CI/CD tests on this runtime error, but I ignored it as it has very low probability and couldnt reproduce it