{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/14940","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/14940/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/14940/comments","events_url":"https://api.github.com/repos/golang/go/issues/14940/events","html_url":"https://github.com/golang/go/issues/14940","id":143125771,"number":14940,"title":"net/http: concurrent map read and map write crash","user":{"login":"bronze1man","id":1107541,"avatar_url":"https://avatars.githubusercontent.com/u/1107541?v=3","gravatar_id":"","url":"https://api.github.com/users/bronze1man","html_url":"https://github.com/bronze1man","followers_url":"https://api.github.com/users/bronze1man/followers","following_url":"https://api.github.com/users/bronze1man/following{/other_user}","gists_url":"https://api.github.com/users/bronze1man/gists{/gist_id}","starred_url":"https://api.github.com/users/bronze1man/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronze1man/subscriptions","organizations_url":"https://api.github.com/users/bronze1man/orgs","repos_url":"https://api.github.com/users/bronze1man/repos","events_url":"https://api.github.com/users/bronze1man/events{/privacy}","received_events_url":"https://api.github.com/users/bronze1man/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-24T02:07:01Z","updated_at":"2016-03-24T02:51:20Z","closed_at":null,"body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n1. What version of Go are you using (`go version`)?\r\ngo version go1.6 linux/amd64\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/go\"\r\nGOTOOLDIR=\"/usr/local/go/pkg/tool/linux_amd64\"\r\nGO15VENDOREXPERIMENT=\"1\"\r\nCC=\"gcc\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\n\r\nThis issues is happend on a product api server with qps about 100/s.\r\nIt will crash the process.\r\n\r\n```\r\nfatal error: concurrent map read and map write\r\n\r\ngoroutine 226231 [running]:\r\nruntime.throw(0x1444b00, 0x21)\r\n\t/usr/local/go/src/runtime/panic.go:530 +0x90 fp=0xc820fed438 sp=0xc820fed420\r\nruntime.mapaccess1_faststr(0x12550e0, 0xc820858bd0, 0x12e2cd0, 0xa, 0x2daa800)\r\n\t/usr/local/go/src/runtime/hashmap_fast.go:202 +0x5b fp=0xc820fed498 sp=0xc820fed438\r\nnet/http.(*Request).wantsClose(0xc8207fc000, 0xc820859000)\r\n\t/usr/local/go/src/net/http/request.go:1071 +0x6d fp=0xc820fed510 sp=0xc820fed498\r\nnet/http.(*chunkWriter).writeHeader(0xc8200fe440, 0x0, 0x0, 0x0)\r\n\t/usr/local/go/src/net/http/server.go:943 +0x7d1 fp=0xc820fed930 sp=0xc820fed510\r\nnet/http.(*chunkWriter).close(0xc8200fe440)\r\n\t/usr/local/go/src/net/http/server.go:286 +0x5d fp=0xc820fedba0 sp=0xc820fed930\r\nnet/http.(*response).finishRequest(0xc8200fe410)\r\n\t/usr/local/go/src/net/http/server.go:1252 +0x96 fp=0xc820fedbd0 sp=0xc820fedba0\r\nnet/http.(*conn).serve(0xc822e27680)\r\n\t/usr/local/go/src/net/http/server.go:1476 +0xf68 fp=0xc820fedf98 sp=0xc820fedbd0\r\nruntime.goexit()\r\n\t/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820fedfa0 sp=0xc820fedf98\r\ncreated by net/http.(*Server).Serve\r\n\t/usr/local/go/src/net/http/server.go:2137 +0x44e\r\n\r\n...\r\n```\r\n\r\nIt generated a 2MB panic log,but\r\n* i can not found hashmap_fast.go in the rest of the log.\r\n* All code run that is write by me in the panic log do not read/write http.Request.Header in the log.\r\n* It happens once per day.\r\n\r\nI may do something bad. but how can i found the bad thing?\r\nWhat is the possible bad thing ?\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/200629921","html_url":"https://github.com/golang/go/issues/14940#issuecomment-200629921","issue_url":"https://api.github.com/repos/golang/go/issues/14940","id":200629921,"user":{"login":"bronze1man","id":1107541,"avatar_url":"https://avatars.githubusercontent.com/u/1107541?v=3","gravatar_id":"","url":"https://api.github.com/users/bronze1man","html_url":"https://github.com/bronze1man","followers_url":"https://api.github.com/users/bronze1man/followers","following_url":"https://api.github.com/users/bronze1man/following{/other_user}","gists_url":"https://api.github.com/users/bronze1man/gists{/gist_id}","starred_url":"https://api.github.com/users/bronze1man/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bronze1man/subscriptions","organizations_url":"https://api.github.com/users/bronze1man/orgs","repos_url":"https://api.github.com/users/bronze1man/repos","events_url":"https://api.github.com/users/bronze1man/events{/privacy}","received_events_url":"https://api.github.com/users/bronze1man/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T02:51:20Z","updated_at":"2016-03-24T02:51:20Z","body":"Is ok to write (*http.Request).Header map in the http.handler callback and in the http.Handler thread?\r\nI just found some handlers in reverse proxy part can write that header."}}