Commit 645a341b authored by David Symonds's avatar David Symonds

net/http: increase panic stack trace buffer size from 4 KB to 64 KB.

4 KB is a bit too small in some situations (e.g. panic during a
template execution), and ends up with an unhelpfully-truncated trace.
64 KB should be much more likely to capture the useful information.
There's not a garbage generation issue, since this code should only
be triggered when there's something seriously wrong with the program.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/63520043
parent 9abe6d9d
...@@ -1083,7 +1083,7 @@ func validNPN(proto string) bool { ...@@ -1083,7 +1083,7 @@ func validNPN(proto string) bool {
func (c *conn) serve() { func (c *conn) serve() {
defer func() { defer func() {
if err := recover(); err != nil { if err := recover(); err != nil {
const size = 4096 const size = 64 << 10
buf := make([]byte, size) buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)] buf = buf[:runtime.Stack(buf, false)]
log.Printf("http: panic serving %v: %v\n%s", c.remoteAddr, err, buf) log.Printf("http: panic serving %v: %v\n%s", c.remoteAddr, err, buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment