-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
What steps will reproduce the problem? 1. Running a heavily utilized network service, like a crawler with 100 threads. 2. Call transport.CloseIdleConnections(), which nils the idleConn member. 3. At some point the transport's putIdleConn() function is called, resulting in a runtime panic because the map is nil. What is the expected output? Not to panic - putIdleConn() should recreate the map like getIdleConn() does. What do you see instead? panic: runtime error: assignment to entry in nil map goroutine 65 [running]: net/http.(*Transport).putIdleConn(0xf8400bcdc0, 0xf8401c7f00, 0x0, 0xf8404edca6, 0xf84025cf18, ...) /home/michael/go/src/pkg/net/http/transport.go:263 +0x1c7 net/http._func_009(0xf84025cf18, 0xf84025ccf8, 0xf84025cb18, 0x44a2ce, 0xf840de81c0, ...) /home/michael/go/src/pkg/net/http/transport.go:575 +0x33 net/http.(*bodyEOFSignal).Close(0xf8405bb3c0, 0x0, 0x0, 0x0) /home/michael/go/src/pkg/net/http/transport.go:719 +0xb6 main.(*FilePoster).posterThread(0xf84008f780, 0xf8400ee780, 0xf80000003d, 0x0, 0x0, ...) /home/michael/gocode/src/concur/autoposter/httppost.go:94 +0x1b29 created by main.(*FilePoster).Start /home/michael/gocode/src/concur/autoposter/fileposter.go:64 +0x349 Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Ubuntu Linux Which revision are you using? (hg identify) f4470a54e6db weekly/weekly.2012-03-04 Please provide any additional information below. I inspected the latest version of /src/pkg/net/http/transport.go and noticed the issue while investigating the panic. The panic does not occur if you don't call CloseIdleConnections(). If you add: if t.idleConn == nil { t.idleConn = make(map[string][]*persistConn) } at line 247 in transport.go I believe it will fix it.