Merge pull request #5110 from reasonerjt/plugin-panic-trace

Dump stack trace when the plugin server handles panic
This commit is contained in:
Xun Jiang/Bruce Jiang
2022-07-11 22:47:17 +08:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -0,0 +1 @@
Dump stack trace when the plugin server handles panic

View File

@@ -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")
}
}