summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
index c7348129a..1428443f5 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
@@ -18,6 +18,7 @@ package runtime
import (
"fmt"
+ "net/http"
"runtime"
"sync"
"time"
@@ -56,8 +57,16 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
}
}
-// logPanic logs the caller tree when a panic occurs.
+// logPanic logs the caller tree when a panic occurs (except in the special case of http.ErrAbortHandler).
func logPanic(r interface{}) {
+ if r == http.ErrAbortHandler {
+ // honor the http.ErrAbortHandler sentinel panic value:
+ // ErrAbortHandler is a sentinel panic value to abort a handler.
+ // While any panic from ServeHTTP aborts the response to the client,
+ // panicking with ErrAbortHandler also suppresses logging of a stack trace to the server's error log.
+ return
+ }
+
// Same as stdlib http server code. Manually allocate stack trace buffer size
// to prevent excessively large logs
const size = 64 << 10