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

Ensure the check command do not panic #581

Open
ahrtr opened this issue Oct 18, 2023 · 3 comments
Open

Ensure the check command do not panic #581

ahrtr opened this issue Oct 18, 2023 · 3 comments

Comments

@ahrtr
Copy link
Member

ahrtr commented Oct 18, 2023

When a db file is corrupted, usually we depend on the check command to diagnose the db file. But if the check command also crashes/panics, then it won't be able to provide any useful diagnosis info.

So we should ensure the check command doesn't panic.

@ishan16696
Copy link
Contributor

I can work on this, can you assign this issue to me @ahrtr ?

@ahrtr
Copy link
Member Author

ahrtr commented Oct 25, 2023

Thanks @ishan16696 . Please feel free to provide a PoC firstly.

@ishan16696
Copy link
Contributor

ishan16696 commented Dec 29, 2023

I'm able to reproduce this issue by corrupting the bolt db file on some leaf pages which lead to check command panic

> ./bbolt check ~/bbolt/default.etcd.test/member/snap/db

panic: assertion failed: Page expected to be: 7, but self identifies as 0

goroutine 5 [running]:
go.etcd.io/bbolt/internal/common.Assert(...)
	~/go/src/backup_forked/bbolt/internal/common/verify.go:65
go.etcd.io/bbolt/internal/common.(*Page).FastCheck(0x10b474000, 0x7)
	~/go/src/backup_forked/bbolt/internal/common/page.go:83 +0x188
go.etcd.io/bbolt.(*Tx).page(0x14000058c68?, 0x10431950c?)
	~/go/src/backup_forked/bbolt/tx.go:539 +0x74
go.etcd.io/bbolt.(*Tx).forEachPageInternal(0x14000058d58?, {0x140000180a0?, 0x1, 0xa}, 0x14000058d28)
	~/go/src/backup_forked/bbolt/tx.go:551 +0x50
go.etcd.io/bbolt.(*Tx).forEachPage(...)
	~/go/src/backup_forked/bbolt/tx.go:547
go.etcd.io/bbolt.(*Tx).checkBucket(0x1400010e000, 0x1400010e018, 0x14000058ea8, 0x14000058ed8, {0x104577818?, 0x1047053a0}, 0x14000022060)
	~/go/src/backup_forked/bbolt/tx_check.go:100 +0xc8
go.etcd.io/bbolt.(*Tx).check(0x1400010e000, {0x104577818, 0x1047053a0}, 0x0?)
	~/go/src/backup_forked/bbolt/tx_check.go:78 +0x288
created by go.etcd.io/bbolt.(*Tx).Check in goroutine 1
	~/go/src/backup_forked/bbolt/tx_check.go:30 +0x124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants