Skip to content

[Release Blocker] t.Block slice index crash #1388

@jarifibrahim

Description

@jarifibrahim

The crash was seen on commit ef28ef3 .
I haven't been able to reproduce the issue but the reuse of byte slices while decompressing aadda9a might be causing this. There was a bug in the reuse code which was fixed by 21735af .

panic: runtime error: slice bounds out of range [-782712:]

goroutine 768 [running]:
github.com/dgraph-io/badger/v2/table.(*Table).block(0xc04879bc00, 0x3a55, 0x1e0000001e0001, 0x3a57, 0x3a56)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/table/table.go:477 +0xac7
github.com/dgraph-io/badger/v2/table.(*Iterator).seekHelper(0xc18f0bc9c0, 0x3a55, 0xc18e249c00, 0x1e, 0x3e)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/table/iterator.go:235 +0x40
github.com/dgraph-io/badger/v2/table.(*Iterator).seekFrom(0xc18f0bc9c0, 0xc18e249c00, 0x1e, 0x3e, 0x0)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/table/iterator.go:271 +0x13a
github.com/dgraph-io/badger/v2/table.(*Iterator).seek(...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/table/iterator.go:287
github.com/dgraph-io/badger/v2/table.(*Iterator).Seek(0xc18f0bc9c0, 0xc18e249c00, 0x1e, 0x3e)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/table/iterator.go:397 +0x93
github.com/dgraph-io/badger/v2.(*levelHandler).get(0xc023bb4000, 0xc18e249c00, 0x1e, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/level_handler.go:275 +0x230
github.com/dgraph-io/badger/v2.(*levelsController).get(0xc00016e310, 0xc18e249c00, 0x1e, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/levels.go:988 +0xcf
github.com/dgraph-io/badger/v2.(*DB).get(0xc023e61400, 0xc18e249c00, 0x1e, 0x3e, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/db.go:638 +0x33f
github.com/dgraph-io/badger/v2.(*valueLog).rewrite.func1(0xc18e249c00, 0x1e, 0x3e, 0xc18e249c1e, 0x20, 0x20, 0x4, 0x0, 0x40, 0x0, ...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:517 +0x114
github.com/dgraph-io/badger/v2.(*valueLog).rewrite.func2(0xc18e249c00, 0x1e, 0x3e, 0xc18e249c1e, 0x20, 0x20, 0x4, 0x0, 0x40, 0x0, ...)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:625 +0x44
github.com/dgraph-io/badger/v2.(*valueLog).iterate(0xc023e615d0, 0xc02256fe60, 0x0, 0xc2303f9a20, 0x1, 0x1, 0x65ec059c)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:489 +0x5ab
github.com/dgraph-io/badger/v2.(*valueLog).rewrite(0xc023e615d0, 0xc02256fe60, 0x1b81960, 0xc00038b520, 0x4, 0x4)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:624 +0x34a
github.com/dgraph-io/badger/v2.(*valueLog).doRunGC(0xc023e615d0, 0xc02256fe60, 0x3fe6666666666666, 0x1b81960, 0xc00038b520, 0x0, 0x0)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:1757 +0xae7
github.com/dgraph-io/badger/v2.(*valueLog).runGC(0xc023e615d0, 0x3fe6666666666666, 0x24000003dd, 0x160100f, 0x0, 0x0)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/value.go:1797 +0x2c3
github.com/dgraph-io/badger/v2.(*DB).RunValueLogGC(0xc023e61400, 0x3fe6666666666666, 0x0, 0x0)
	/go/pkg/mod/github.com/dgraph-io/badger/v2@v2.0.1-rc1.0.20200515210839-ef28ef36b592/db.go:1192 +0x1e3
github.com/dgraph-io/dgraph/x.RunVlogGC.func1()
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/x.go:894 +0x4a
github.com/dgraph-io/dgraph/x.RunVlogGC(0xc023e61400, 0xc0793442c0)
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/x.go:910 +0x219
created by github.com/dgraph-io/dgraph/worker.(*ServerState).initStorage
	/ext-go/1/src/github.com/dgraph-io/dgraph/worker/server_state.go:171 +0x7fb

The crash is originating from this line
https://github.com/dgraph-io/badger/blob/ef28ef36b5923f12ffe3a1702bdfa6b479db6637/table/table.go#L477

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/crashThis issue causes a panic or some other of exception that causes a crash.help wantedPlease help us fix this!kind/bugSomething is broken.priority/P1Serious issue that requires eventual attention (can wait a bit)releaseblockerstatus/acceptedWe accept to investigate or work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions