harvester / harvester

Open source hyperconverged infrastructure (HCI) software

Home Page:https://harvesterhci.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Crash when writing error status on VM backup

nistei opened this issue · comments

Describe the bug
When creating a VM backup that has an error (e.g. PVC not found) Harvester crashes when there is not already a status set on the VMBackup. In our case, the error is caused by a PVC not being found.

To Reproduce
Steps to reproduce the behavior:

  1. Create a VM backup that will error (in our case, attaching a rook-ceph volume to the VM causes an error)
  2. Go to VM Backups
  3. See the Error label on the Backup but no status set. Harvester is in a crash loop.

Expected behavior
Harvester does not crash and sets the status properly.

Support bundle

Environment

  • Harvester ISO version: v1.3.0

Additional context

E0513 16:40:26.195095       7 runtime.go:79] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 2388 [running]:
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/runtime.logPanic({0x280f820?, 0x50d2b10})
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:75 +0x99
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc0063b6160?})
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:49 +0x75
panic({0x280f820, 0x50d2b10})
    /usr/local/go/src/runtime/panic.go:884 +0x213
github.com/harvester/harvester/pkg/controller/master/backup.(*Handler).setStatusError(0xc000f9ca00, 0xc000e94100?, {0x3434b20, 0xc002164000})
    /go/src/github.com/harvester/harvester/pkg/controller/master/backup/backup.go:756 +0x128
github.com/harvester/harvester/pkg/controller/master/backup.(*Handler).OnBackupChange(0x0?, {0x0?, 0x0?}, 0xc000e94100)
    /go/src/github.com/harvester/harvester/pkg/controller/master/backup/backup.go:166 +0x1da
time="2024-05-13T16:40:26Z" level=info msg="Starting harvesterhci.io/v1beta1, Kind=Upgrade controller"
github.com/harvester/harvester/pkg/generated/controllers/harvesterhci.io/v1beta1.FromVirtualMachineBackupHandlerToHandler.func1({0xc000e1f4f0?, 0xc?}, {0x343b0c0?, 0xc000e94100?})
    /go/src/github.com/harvester/harvester/pkg/generated/controllers/harvesterhci.io/v1beta1/virtualmachinebackup.go:102 +0x4d
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.SharedControllerHandlerFunc.OnChange(0x0?, {0xc000e1f4f0?, 0x0?}, {0x343b0c0?, 0xc000e94100?})
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/sharedcontroller.go:29 +0x38
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*SharedHandler).OnChange(0xc00038c910, {0xc000e1f4f0, 0xc}, {0x343b0c0, 0xc000e94100})
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/sharedhandler.go:75 +0x218
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*controller).syncHandler(0xc0011809a0, {0xc000e1f4f0, 0xc})
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/controller.go:232 +0x93
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*controller).processSingleItem(0xc0011809a0, {0x26a3740?, 0xc0063b6160?})
time="2024-05-13T16:40:26Z" level=info msg="Starting apps/v1, Kind=StatefulSet controller"
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/controller.go:213 +0x105
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*controller).processNextWorkItem(0xc0011809a0)
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/controller.go:190 +0x46
github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*controller).runWorker(...)
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/controller.go:179
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0x30?)
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:226 +0x3e
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0x0?, {0x3434de0, 0xc006aa8570}, 0x1, 0xc00061c8a0)
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:227 +0xb6
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil(0x0?, 0x3b9aca00, 0x0, 0x0?, 0x0?)
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:204 +0x89
github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait.Until(0x0?, 0x0?, 0x0?)
    /go/src/github.com/harvester/harvester/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go:161 +0x25
created by github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller.(*controller).run
    /go/src/github.com/harvester/harvester/vendor/github.com/rancher/lasso/pkg/controller/controller.go:147 +0x345
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x20a6588]