panic in net/http/server.go

279 views
Skip to first unread message

To...@soundcloud.com

unread,
Aug 20, 2013, 11:10:42 AM8/20/13
to golan...@googlegroups.com
Hey there,

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.
Here is the top of the backtrace. What other information can we provide to help debug the issue?

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
Message has been deleted

To...@soundcloud.com

unread,
Aug 20, 2013, 5:09:05 PM8/20/13
to golan...@googlegroups.com, To...@soundcloud.com, island...@gmail.com
The documentation for the http.TimeoutHandler explicitly says that "After such a timeout, writes by h to its ResponseWriter will return ErrHandlerTimeout.".
I am checking for such an error after calling Write on the ResponseWriter and handle it by just returning from the handler.

On Tuesday, August 20, 2013 5:19:55 PM UTC+2, island...@gmail.com wrote:
The write at http://golang.org/src/pkg/net/http/server.go#L1743 can execute concurrently with the write at be http://golang.org/src/pkg/net/http/server.go#L1718. Does the server's response writer support concurrent writes?
Reply all
Reply to author
Forward
0 new messages