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

BR panics when backing up to an S3-compatible storage that does not implement object locking #39545

Closed
kennytm opened this issue Dec 1, 2022 · 1 comment · Fixed by #39549
Labels
affects-6.3 affects-6.4 component/br This issue is related to BR of TiDB. severity/moderate type/bug This issue is a bug.

Comments

@kennytm
Copy link
Contributor

kennytm commented Dec 1, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Backup to an external S3-compatible storage on Huawei OBS

br backup full -s s3://bucket/prefix?endpoint=https://obs.cn-east-3.myhuaweicloud.com/ ...

2. What did you expect to see? (Required)

Backup success

3. What did you see instead (Required)

Panics with this stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x31428da]goroutine 1 [running]:
github.com/pingcap/tidb/br/pkg/storage.(*S3Storage).isObjectLockEnabled(0xc0014222a0)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/storage/s3.go:460 +0x29a
github.com/pingcap/tidb/br/pkg/storage.newS3Storage(0xc00024e3c0, 0xc00107d4f8)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/storage/s3.go:403 +0xe25
github.com/pingcap/tidb/br/pkg/storage.New({0x5266050?, 0xc000646340?}, 0xc00121ee48?, 0x1880727?)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/storage/storage.go:176 +0x75
github.com/pingcap/tidb/br/pkg/backup.(*Client).SetStorage(0xc000eac740, {0x5266050?, 0xc000646340?}, 0x4b4aba6?, 0x5266050?)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/backup/client.go:223 +0x5b
github.com/pingcap/tidb/br/pkg/backup.(*Client).SetStorageAndCheckNotInUse(0xc000eac740, {0x5266050, 0xc000646340}, 0xc000e3a900?, 0x0?)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/backup/client.go:192 +0x2c
github.com/pingcap/tidb/br/pkg/task.RunBackup({0x5266050, 0xc000d0e540}, {0x527e410?, 0x7a79bd8?}, {0x4b33732, 0xb}, 0xc00092c380)
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/task/backup.go:332 +0x735
main.runBackupCommand(0xc000d94c80, {0x4b33732, 0xb})
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/cmd/br/backup.go:48 +0x418
main.newFullBackupCommand.func1(0xc000d94c80?, {0xc000d5c840?, 0xb?, 0xb?})
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/cmd/br/backup.go:117 +0x25
github.com/spf13/cobra.(*Command).execute(0xc000d94c80, {0xc00013c030, 0xb, 0xb})
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc000d19180)
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
    /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
    /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/cmd/br/main.go:57 +0x33c 

4. What is your TiDB version? (Required)

v6.4.0

@kennytm kennytm added type/bug This issue is a bug. component/br This issue is related to BR of TiDB. affects-6.3 affects-6.4 labels Dec 1, 2022
@kennytm
Copy link
Contributor Author

kennytm commented Dec 1, 2022

tidb/br/pkg/storage/s3.go

Lines 459 to 463 in ac0d36b

if resp.ObjectLockConfiguration != nil {
if s3.ObjectLockEnabledEnabled == *resp.ObjectLockConfiguration.ObjectLockEnabled {
return true
}
}

The code only checked whether resp.ObjectLockConfiguration is nil, but not if resp.ObjectLockConfiguration.ObjectLockEnabled is nil.

The code should use aws.StringValue(x) instead of *x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.3 affects-6.4 component/br This issue is related to BR of TiDB. severity/moderate type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants