While load testing an http.Handler which is wrapped by the http.TimeoutHandler and after reaching the arbitrary testing timeout of 10 seconds, we had the server panicking.
2013-08-20_14:13:07.66581 2013/08/20 14:13:07.665673 http: multiple response.WriteHeader calls
2013-08-20_14:13:07.69367 panic: runtime error: invalid memory address or nil pointer dereference
2013-08-20_14:13:07.69371 [signal 0xb code=0x1 addr=0x20 pc=0x43fec1]
2013-08-20_14:13:07.69371
2013-08-20_14:13:07.69372 goroutine 11568 [running]:
2013-08-20_14:13:07.69373 net/http.(*chunkWriter).Write(0xc204a0b410, 0xc207b01000, 0x6e28, 0xa168, 0x4279, ...)
2013-08-20_14:13:07.69374 /usr/local/go/src/pkg/net/http/server.go:261 +0x281
2013-08-20_14:13:07.69527 net/http.(*switchWriter).Write(0xc202c580c0, 0xc207b01000, 0x6e28, 0xa168, 0xc202264860, ...)
2013-08-20_14:13:07.69530 /usr/local/go/src/pkg/net/http/chunked.go:0 +0x62
2013-08-20_14:13:07.69531 bufio.(*Writer).Write(0xc2046709c0, 0xc207b01000, 0x6e28, 0xa168, 0x0, ...)
2013-08-20_14:13:07.69531 /usr/local/go/src/pkg/bufio/bufio.go:497 +0xbd
2013-08-20_14:13:07.69532 net/http.(*response).Write(0xc204a0b3f0, 0xc207b01000, 0x6e28, 0xa168, 0x7281d0, ...)
2013-08-20_14:13:07.69533 /usr/local/go/src/pkg/net/http/server.go:918 +0x22f
2013-08-20_14:13:07.69533 net/http.(*timeoutWriter).Write(0xc203eb5940, 0xc207b01000, 0x6e28, 0xa168, 0x5, ...)
2013-08-20_14:13:07.69534 /usr/local/go/src/pkg/net/http/server.go:1743 +0xaf
2013-08-20_14:13:07.69535 main.response.Write(0xc204880000, 0x93, 0x100, 0xc202c58200, 0x10, ...)
2013-08-20_14:13:07.69535 [REDACTED]
2013-08-20_14:13:07.69536 main.func·002(0xc2001a4980, 0xc203eb5940, 0xc2040438f0)
2013-08-20_14:13:07.69537 [REDACTED]
2013-08-20_14:13:07.69537 net/http.HandlerFunc.ServeHTTP(0xc2000d4f00, 0xc2001a4980, 0xc203eb5940, 0xc2040438f0)
2013-08-20_14:13:07.69538 /usr/local/go/src/pkg/net/http/server.go:1149 +0x3e
2013-08-20_14:13:07.69544 net/http.func·010()
2013-08-20_14:13:07.69549 /usr/local/go/src/pkg/net/http/server.go:1707 +0x84
2013-08-20_14:13:07.69560 created by net/http.(*timeoutHandler).ServeHTTP
2013-08-20_14:13:07.69569 /usr/local/go/src/pkg/net/http/server.go:1709 +0x134
Tomás