Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Nil pointer dereference during error handling #2105

Open
debugloop opened this issue Sep 9, 2024 · 0 comments
Open

[BUG]: Nil pointer dereference during error handling #2105

debugloop opened this issue Sep 9, 2024 · 0 comments
Labels
kind/bug Something is broken.

Comments

@debugloop
Copy link

What version of Badger are you using?

v4.3.0

What version of Go are you using?

1.22

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, CPU, OS)?

Linux 5.17.15-v7l #1 SMP Wed Dec 6 13:01:48 UTC 2023 armv7l armv7l armv7l GNU/Linux

CPU: ARMv7 Processor rev 3 (v7l)
RAM: 1GB

What steps will reproduce the bug?

After a (probably) faulty write to a strictly in-memory only badger database, our code encountered an error during decompression of a block. However, the Fd field of the method receiver seems to be nil for in-memory databases.

Expected behavior and actual result.

There is an error without a panic being triggered.

Additional information

panic({0x842d40, 0xf4f548})
	/usr/local/go/src/runtime/panic.go:770 +0xfc
os.(*File).Name(...)
	/usr/local/go/src/os/file.go:56
github.com/dgraph-io/badger/v4/table.(*Table).block(0x2d62f50, 0x19ce, 0x1)
	/go/src/vendor/github.com/dgraph-io/badger/v4/table/table.go:582 +0x750
github.com/dgraph-io/badger/v4/table.(*Iterator).seekHelper(0x37a2380, 0x19ce, {0x37d9b80, 0x32, 0x32})
	/go/src/vendor/github.com/dgraph-io/badger/v4/table/iterator.go:254 +0x4c
github.com/dgraph-io/badger/v4/table.(*Iterator).seekFrom(0x37a2380, {0x37d9b80, 0x32, 0x32}, 0x0)
	/go/src/vendor/github.com/dgraph-io/badger/v4/table/iterator.go:294 +0x12c
github.com/dgraph-io/badger/v4/table.(*Iterator).seek(...)
	/go/src/vendor/github.com/dgraph-io/badger/v4/table/iterator.go:310
github.com/dgraph-io/badger/v4/table.(*Iterator).Seek(0x37a2380, {0x37d9b80, 0x32, 0x32})
	/go/src/vendor/github.com/dgraph-io/badger/v4/table/iterator.go:424 +0x58
github.com/dgraph-io/badger/v4.(*levelHandler).get(0x2ce0050, {0x37d9b80, 0x32, 0x32})
	/go/src/vendor/github.com/dgraph-io/badger/v4/level_handler.go:293 +0x238
github.com/dgraph-io/badger/v4.(*levelsController).get(0x2ce0000, {0x37d9b80, 0x32, 0x32}, {0x40, 0x0, 0x0, {0x95db23a, 0x13d0, 0x52c00bf}, ...}, ...)
	/go/src/vendor/github.com/dgraph-io/badger/v4/levels.go:1623 +0x174
github.com/dgraph-io/badger/v4.(*DB).get(0x2d4b208, {0x37d9b80, 0x32, 0x32})
	/go/src/vendor/github.com/dgraph-io/badger/v4/db.go:786 +0x3a8
github.com/dgraph-io/badger/v4.(*Txn).Get(0x917a240, {0x2eada10, 0x2a, 0x30})
	/go/src/vendor/github.com/dgraph-io/badger/v4/txn.go:479 +0x2bc
@debugloop debugloop added the kind/bug Something is broken. label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken.
Development

No branches or pull requests

1 participant