Skip to content

Commit b47a96e

Browse files
committed
backup: improve panic in restoreDataProcessor
A test is causing a panic being emitted by `Wait()`, but the original stack trace of the panic does not show up in logs. Catch and rethrow the panic including full details. Informs: #141606 Release note: None
1 parent 8c96475 commit b47a96e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/backup/restore_data_processor.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ func (rd *restoreDataProcessor) Start(ctx context.Context) {
191191

192192
ctx, cancel := context.WithCancel(ctx)
193193
rd.cancelWorkersAndWait = func() {
194+
defer func() {
195+
// A panic here will not have a useful stack trace. If the panic is an
196+
// error that contains a stack trace, we want those full details.
197+
// TODO(jeffswenson): improve panic recovery more generally.
198+
if p := recover(); p != nil {
199+
panic(fmt.Sprintf("restore worker hit panic: %+v", p))
200+
}
201+
}()
194202
cancel()
195203
_ = rd.phaseGroup.Wait()
196204
}

0 commit comments

Comments
 (0)