Description
Saw the following dump in logs in MB-31477. A nil error caused xdcr to panic.
The code is in utils.ExponentialBackoffExecutorWithFinishSignal().
err = fmt.Errorf("%v %v Last error: %v", name, base.ErrorFailedAfterRetry.Error(), err.Error())
err.Error() would panic if err is nil.
err is always not nil in normal execution path. err could be nil when the method exits due to timeout, though.
2018-10-01T16:02:48.904-07:00 WARN GOXDCR.Utils: ExponentialBackoffExecutorWithFinishSignal for StatsMapOnVBToSeqno aborting because of finch closure
2018-10-01T16:02:48.904-07:00 INFO GOXDCR.CheckpointMgr: Done one time checkpointing for replication 56588e1ffae793e05948c77a6e28360d/mem/rep-mem
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x7cbec9]
goroutine 2028 [running]:
github.com/couchbase/goxdcr/utils.(*Utilities).ExponentialBackoffExecutorWithFinishSignal(0xc42000e1a8, 0xa3ede2, 0x13, 0xbebc200, 0x5, 0x2, 0xc420abd3c0, 0x0, 0x0, 0xc42087efc0, ...)
goproj/src/github.com/couchbase/goxdcr/utils/utils.go:2416 +0x419
github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).getHighSeqnoAndVBUuidForServerWithRetry(0xc420175b00, 0xc420878800, 0x38, 0xc420423400, 0x200, 0x200, 0xc42024e000, 0xc42087efc0)
goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:445 +0x18c
github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).getHighSeqnoAndVBUuidFromTarget(0xc420175b00, 0xc42087efc0, 0x0)
goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:407 +0x172
github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).PerformCkpt(0xc420175b00, 0xc42087efc0)
goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:1020 +0x58d
github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).CheckpointBeforeStop.func1(0xc420175b00, 0xc42087efc0, 0xc42087ef50)
goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:485 +0x35
created by github.com/couchbase/goxdcr/pipeline_svc.(*CheckpointManager).CheckpointBeforeStop
goproj/src/github.com/couchbase/goxdcr/pipeline_svc/checkpoint_manager.go:487 +0x216