Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: TimeoutHandler hides panic locations #27375

pvhau opened this issue Aug 30, 2018 · 1 comment


None yet
2 participants
Copy link

commented Aug 30, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?


Does this issue reproduce with the latest release?

Not sure, I am finding a solution with my current version

What operating system and processor architecture are you using (go env)?

OS: linux, arch: amd64

What did you do?

This is a demo

import (

type sampleHandler string
func (s sampleHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
	var mm interface{}
	log.Print("This will be panic")

func main() {
	go func() {
		http.ListenAndServe("localhost:8888", http.TimeoutHandler(sampleHandler("sample"), time.Second*10, "Timeout"))

	time.Sleep(time.Second * 2)

What did you expect to see?

I expect to see stack trace point to where cause panic (log.Print(mm.(string))) so that I can debug app easily

What did you see instead?

Stack trace point me panic(p) statement in net/http.timeoutHandler (go/src/net/http/server.go:3144). I know it make sense because that is the place that call panic. Are there any good solution to passing stack trace from handler inside TimeoutHandler?

@pvhau pvhau changed the title Passing panic stack trace inside TimeoutHandler Passing panic's stacktrace inside TimeoutHandler Aug 30, 2018

@FiloSottile FiloSottile added this to the Unplanned milestone Aug 31, 2018

@FiloSottile FiloSottile changed the title Passing panic's stacktrace inside TimeoutHandler net/http: TimeoutHandler hides panic locations Aug 31, 2018


This comment has been minimized.

Copy link

commented Aug 31, 2018

/cc @bradfitz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.