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>pull/5110/head
parent
267db7a931
commit
9102f53131
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue