mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
remove TrimSuffix and document buffer size
This commit is contained in:
parent
5c81571b01
commit
0e61b77826
@ -25,7 +25,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
goruntime "runtime"
|
goruntime "runtime"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
@ -197,10 +196,12 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object,
|
|||||||
defer func() {
|
defer func() {
|
||||||
panicReason := recover()
|
panicReason := recover()
|
||||||
if panicReason != nil {
|
if panicReason != nil {
|
||||||
|
// Same as stdlib http server code. Manually allocate stack
|
||||||
|
// trace buffer size to prevent excessively large logs
|
||||||
const size = 64 << 10
|
const size = 64 << 10
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
buf = buf[:goruntime.Stack(buf, false)]
|
buf = buf[:goruntime.Stack(buf, false)]
|
||||||
panicReason = strings.TrimSuffix(fmt.Sprintf("%v\n%s", panicReason, string(buf)), "\n")
|
panicReason = fmt.Sprintf("%v\n%s", panicReason, buf)
|
||||||
// Propagate to parent goroutine
|
// Propagate to parent goroutine
|
||||||
panicCh <- panicReason
|
panicCh <- panicReason
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,8 @@ func (t *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
err := recover()
|
err := recover()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Same as stdlib http server code. Manually allocate stack
|
||||||
|
// trace buffer size to prevent excessively large logs
|
||||||
const size = 64 << 10
|
const size = 64 << 10
|
||||||
buf := make([]byte, size)
|
buf := make([]byte, size)
|
||||||
buf = buf[:runtime.Stack(buf, false)]
|
buf = buf[:runtime.Stack(buf, false)]
|
||||||
|
Loading…
Reference in New Issue
Block a user