etcd-operator icon indicating copy to clipboard operation
etcd-operator copied to clipboard

Backup sidecar crashes endlessly after minikube restart

Open ohkojai opened this issue 9 years ago • 10 comments

I've got etcd-operator running in minikube with a PersistentVolume providing backup. It seems to have trouble when the minikube VM is restarted. The backup sidecar crashes in an endless loop. This is the output of the backup sidecar:

time="2017-11-11T01:00:09Z" level=info msg="listening on 0.0.0.0:19999"
time="2017-11-11T01:00:31Z" level=info msg="received a backup request"
time="2017-11-11T01:00:31Z" level=info msg="getMaxRev: member etcd-cluster-0018 revision (9)"
time="2017-11-11T01:00:31Z" level=info msg="skipped creating new backup: no change since last time"
panic: runtime error: index out of range

goroutine 14 [running]:
github.com/coreos/etcd-operator/pkg/backup.(*BackupController).Run(0xc420151560)
	/Users/haseeb/work/go-space/src/github.com/coreos/etcd-operator/pkg/backup/backup.go:186 +0x625
created by main.main
	/Users/haseeb/work/go-space/src/github.com/coreos/etcd-operator/cmd/backup/main.go:91 +0x2d1

I had expected it to restore from a previous backup and resume normal operations. It has done so successfully in the past (more or less). I'm not sure what's special about this time. Maybe the backup data is somehow corrupted?

Happy to provide more information if it will help.

ohkojai avatar Nov 11 '17 01:11 ohkojai

Incidentally, the etcd cluster is unusable in this state. The etcd pods keep crashing. The logs end with a critical message:

2017-11-11 01:11:35.546194 C | etcdmain: error validating peerURLs {ClusterID:38fcbe20f5752b06 Members:[&{ID:1fda48838ce69890 RaftAttributes:{PeerURLs:[http://etcd-cluster-0003.etcd-cluster.etcd.svc:2380]} Attributes:{Name: ClientURLs:[]}} &{ID:e615ba7a5bca48a2 RaftAttributes:{PeerURLs:[http://etcd-cluster-0002.etcd-cluster.etcd.svc:2380]} Attributes:{Name:etcd-cluster-0002 ClientURLs:[http://etcd-cluster-0002.etcd-cluster.etcd.svc:2379]}}] RemovedMemberIDs:[]}: unmatched member while checking PeerURLs

ohkojai avatar Nov 11 '17 01:11 ohkojai

@fanminshi Can you look into it? Any potential problem in 0.7.0 etcd operator?

hongchaodeng avatar Nov 11 '17 03:11 hongchaodeng

@hongchaodeng will take a look.

fanminshi avatar Nov 13 '17 18:11 fanminshi

@zhaytee What's the version of etcd operator? How to reproduce the failure? Please let us know more info so that we can help you.

hongchaodeng avatar Nov 15 '17 22:11 hongchaodeng

@zhaytee what's the etcd operator version that you were using?

fanminshi avatar Nov 16 '17 22:11 fanminshi

This is the same issue as https://github.com/coreos/etcd-operator/issues/1613

It is caused by that we return nil backupStatus if there isn't newer revision than the current backup one: https://github.com/coreos/etcd-operator/blob/v0.6.1/pkg/backup/backup_manager.go#L85

Then it skipped updating the array: https://github.com/coreos/etcd-operator/blob/v0.6.1/pkg/backup/backup.go#L175

Finally it caused panic here: https://github.com/coreos/etcd-operator/blob/v0.6.1/pkg/backup/backup.go#L186

hongchaodeng avatar Nov 16 '17 23:11 hongchaodeng

Closing as this logic is not an issue anymore

hongchaodeng avatar Nov 16 '17 23:11 hongchaodeng

@fanminshi I'm using version 0.6.1.

It seems to break when minikube is restarted, such as when my laptop sleeps and wakes, causing the underlying VM to pause and then resume. I can't seem to reproduce it manually right now (of course), but I'll post here the next time it happens.

ohkojai avatar Nov 16 '17 23:11 ohkojai

@zhaytee it is a bug in 0.6.1. @hongchaodeng and I have figured the cause. However, from v0.7.0 this issue shouldn't appear anymore since we have move the backup logic out of etcd operator to etcd back operator. Please take a look of the 0.7.0 release note to learn about the etcd backup operator.

fanminshi avatar Nov 17 '17 00:11 fanminshi

@fanminshi Sounds good, thank you.

ohkojai avatar Nov 17 '17 00:11 ohkojai