mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
Dump stack trace when the plugin server handles panic
Mitigate the issue mentioned in #4782 When there's a bug or misconfiguration that causes nil pointer there will be more stack trace information to help us debug. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
1
changelogs/unreleased/5110-reasonerjt
Normal file
1
changelogs/unreleased/5110-reasonerjt
Normal file
@@ -0,0 +1 @@
|
||||
Dump stack trace when the plugin server handles panic
|
||||
@@ -17,6 +17,8 @@ limitations under the License.
|
||||
package framework
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
@@ -38,7 +40,8 @@ func handlePanic(p interface{}) error {
|
||||
if _, ok := panicErr.(stackTracer); ok {
|
||||
err = panicErr
|
||||
} else {
|
||||
err = errors.Wrap(panicErr, "plugin panicked")
|
||||
errWithStacktrace := errors.Errorf("%v, stack trace: %s", panicErr, debug.Stack())
|
||||
err = errors.Wrap(errWithStacktrace, "plugin panicked")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user