{"action":"created","issue":{"url":"https://api.github.com/repos/valyala/fasthttp/issues/506","repository_url":"https://api.github.com/repos/valyala/fasthttp","labels_url":"https://api.github.com/repos/valyala/fasthttp/issues/506/labels{/name}","comments_url":"https://api.github.com/repos/valyala/fasthttp/issues/506/comments","events_url":"https://api.github.com/repos/valyala/fasthttp/issues/506/events","html_url":"https://github.com/valyala/fasthttp/issues/506","id":394974427,"node_id":"MDU6SXNzdWUzOTQ5NzQ0Mjc=","number":506,"title":"fatal error: concurrent map read and map write","user":{"login":"densmnko","id":6163919,"node_id":"MDQ6VXNlcjYxNjM5MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6163919?v=4","gravatar_id":"","url":"https://api.github.com/users/densmnko","html_url":"https://github.com/densmnko","followers_url":"https://api.github.com/users/densmnko/followers","following_url":"https://api.github.com/users/densmnko/following{/other_user}","gists_url":"https://api.github.com/users/densmnko/gists{/gist_id}","starred_url":"https://api.github.com/users/densmnko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/densmnko/subscriptions","organizations_url":"https://api.github.com/users/densmnko/orgs","repos_url":"https://api.github.com/users/densmnko/repos","events_url":"https://api.github.com/users/densmnko/events{/privacy}","received_events_url":"https://api.github.com/users/densmnko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-31T12:34:53Z","updated_at":"2018-12-31T13:36:04Z","closed_at":null,"author_association":"NONE","body":"Dear @valyala, thanks a lot for you awesome fasthttp. \r\n\r\nI`m new to golang and may be its my fault, but got twice (on a dozen runs) a \"fatal error: concurrent map read and map write\". \r\n--------------------------- first stack ----------------------------------------\r\nfatal error: concurrent map read and map write\r\n\r\ngoroutine 992 [running]:\r\nruntime.throw(0x71ab07, 0x21)\r\n/usr/local/go/src/runtime/panic.go:608 +0x72 fp=0xc0000ab9f8 sp=0xc0000ab9c8 pc=0x42c372\r\nruntime.mapaccess2_faststr(0x6b4a00, 0xc000077110, 0xc026352f60, 0x13, 0x0, 0x0)\r\n/usr/local/go/src/runtime/map_faststr.go:110 +0x458 fp=0xc0000aba68 sp=0xc0000ab9f8 pc=0x413598\r\nmain.UpdateHandler(0xc0321a5200, 0x32135)\r\n/root/go/src/dumb/main.go:373 +0x61a fp=0xc0000abbc0 sp=0xc0000aba68 pc=0x66deea\r\nmain.Router(0xc0321a5200)\r\n/root/go/src/dumb/main.go:675 +0x874 fp=0xc0000abd20 sp=0xc0000abbc0 pc=0x6708a4\r\ngithub.com/valyala/fasthttp.(*Server).serveConn(0xc0000921a0, 0x765020, 0xc0269260f0, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1926 +0x77a fp=0xc0000abea0 sp=0xc0000abd20 pc=0x657dca\r\ngithub.com/valyala/fasthttp.(*Server).serveConn-fm(0x765020, 0xc0269260f0, 0x1, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1531 +0x3e fp=0xc0000abed8 sp=0xc0000abea0 pc=0x66144e\r\ngithub.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0000e0090, 0xc00f64c6c0)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:212 +0xc3 fp=0xc0000abf98 sp=0xc0000abed8 pc=0x65ec83\r\ngithub.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0000e0090, 0xc00f64c6c0, 0x6975e0, 0xc00f64c6c0)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:184 +0x35 fp=0xc0000abfc0 sp=0xc0000abf98 pc=0x65f635\r\nruntime.goexit()\r\n/usr/local/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc0000abfc8 sp=0xc0000abfc0 pc=0x458621\r\ncreated by github.com/valyala/fasthttp.(*workerPool).getCh\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:183 +0x119\r\n\r\ngoroutine 1 [IO wait]:\r\ninternal/poll.runtime_pollWait(0x7f178c7390f0, 0x72, 0x0)\r\n/usr/local/go/src/runtime/netpoll.go:173 +0x66\r\ninternal/poll.(*pollDesc).wait(0xc000012318, 0x72, 0xc00b0dcf00, 0x0, 0x0)\r\n/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9a\r\ninternal/poll.(*pollDesc).waitRead(0xc000012318, 0xffffffffffffff00, 0x0, 0x0)\r\n/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d\r\ninternal/poll.(*FD).Accept(0xc000012300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)\r\n/usr/local/go/src/internal/poll/fd_unix.go:384 +0x1a0\r\nnet.(*netFD).accept(0xc000012300, 0x4, 0xc0000adc58, 0x406d5c)\r\n/usr/local/go/src/net/fd_unix.go:238 +0x42\r\nnet.(*TCPListener).accept(0xc009056020, 0xc021d60780, 0xc0000adcd8, 0x406bcf)\r\n/usr/local/go/src/net/tcpsock_posix.go:139 +0x2e\r\nnet.(*TCPListener).Accept(0xc009056020, 0x0, 0xc0269260f0, 0x0, 0xc0000add10)\r\n/usr/local/go/src/net/tcpsock.go:260 +0x47\r\ngithub.com/valyala/fasthttp.acceptConn(0xc0000921a0, 0x763ca0, 0xc009056020, 0xc0000ade20, 0x765020, 0xc0269260f0, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1625 +0x49\r\ngithub.com/valyala/fasthttp.(*Server).Serve(0xc0000921a0, 0x763ca0, 0xc009056020, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1547 +0x2bd\r\ngithub.com/valyala/fasthttp.(*Server).ListenAndServe(0xc0000921a0, 0x71155f, 0x3, 0x6a4440, 0xc063248040)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1340 +0xa7\r\ngithub.com/valyala/fasthttp.ListenAndServe(0x71155f, 0x3, 0x726930, 0x2, 0x2)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:91 +0x60\r\nmain.main()\r\n/root/go/src/dumb/main.go:528 +0x246\r\n\r\ngoroutine 5 [sleep]:\r\ntime.Sleep(0x3b9aca00)\r\n/usr/local/go/src/runtime/time.go:105 +0x14f\r\ngithub.com/valyala/fasthttp.init.0.func1()\r\n/root/go/src/github.com/valyala/fasthttp/header.go:1441 +0x2a\r\ncreated by github.com/valyala/fasthttp.init.0\r\n/root/go/src/github.com/valyala/fasthttp/header.go:1439 +0x3a\r\n\r\ngoroutine 7 [sleep]:\r\ntime.Sleep(0x2540be400)\r\n/usr/local/go/src/runtime/time.go:105 +0x14f\r\ngithub.com/valyala/fasthttp.(*workerPool).Start.func1(0xc0000e0090, 0xc0000162a0)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:61 +0x57\r\ncreated by github.com/valyala/fasthttp.(*workerPool).Start\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:53 +0x7f\r\n\r\ngoroutine 2034 [runnable]:\r\nsyscall.Syscall(0x3, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0)\r\n/usr/local/go/src/syscall/asm_linux_amd64.s:18 +0x5\r\nsyscall.Close(0x5, 0x7f1781a5ecb8, 0x77)\r\n/usr/local/go/src/syscall/zsyscall_linux_amd64.go:310 +0x40\r\ninternal/poll.(*FD).destroy(0xc027d15f80, 0x485b01, 0x7f1781a5ecb0)\r\n/usr/local/go/src/internal/poll/fd_unix.go:78 +0x4e\r\ninternal/poll.(*FD).decref(0xc027d15f80, 0x1, 0xc028e7f1a0)\r\n/usr/local/go/src/internal/poll/fd_mutex.go:213 +0x45\r\ninternal/poll.(*FD).Close(0xc027d15f80, 0xc027d15f80, 0x0)\r\n/usr/local/go/src/internal/poll/fd_unix.go:100 +0x9b\r\nnet.(*netFD).Close(0xc027d15f80, 0x765020, 0xc0269260e8)\r\n/usr/local/go/src/net/fd_unix.go:184 +0x4f\r\nnet.(*conn).Close(0xc0269260e8, 0x0, 0x0)\r\n/usr/local/go/src/net/net.go:201 +0x4a\r\ngithub.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0000e0090, 0xc00e013540)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:224 +0x292\r\ngithub.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0000e0090, 0xc00e013540, 0x6975e0, 0xc00e013540)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:184 +0x35\r\ncreated by github.com/valyala/fasthttp.(*workerPool).getCh\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:183 +0x119\r\n\r\n--------------------------- second stack ----------------------------------------\r\nfatal error: concurrent map read and map write\r\n\r\ngoroutine 2007 [running]:\r\nruntime.throw(0x7198b8, 0x21)\r\n/usr/local/go/src/runtime/panic.go:608 +0x72 fp=0xc00fa7daa0 sp=0xc00fa7da70 pc=0x42c372\r\nruntime.mapaccess2_faststr(0x6b3980, 0xc00007d110, 0xc04fede540, 0x1b, 0x0, 0x0)\r\n/usr/local/go/src/runtime/map_faststr.go:110 +0x458 fp=0xc00fa7db10 sp=0xc00fa7daa0 pc=0x413598\r\nmain.NewHandler(0xc00d262900)\r\n/root/go/src/dumb/main.go:236 +0x10f fp=0xc00fa7dc68 sp=0xc00fa7db10 pc=0x66d04f\r\nmain.Router(0xc00d262900)\r\n/root/go/src/dumb/main.go:675 +0x580 fp=0xc00fa7dd20 sp=0xc00fa7dc68 pc=0x6703c0\r\ngithub.com/valyala/fasthttp.(*Server).serveConn(0xc0000a41a0, 0x763bc0, 0xc01834e650, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1926 +0x77a fp=0xc00fa7dea0 sp=0xc00fa7dd20 pc=0x657eba\r\ngithub.com/valyala/fasthttp.(*Server).serveConn-fm(0x763bc0, 0xc01834e650, 0x1, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1531 +0x3e fp=0xc00fa7ded8 sp=0xc00fa7dea0 pc=0x66153e\r\ngithub.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0000f2090, 0xc015504200)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:212 +0xc3 fp=0xc00fa7df98 sp=0xc00fa7ded8 pc=0x65ed73\r\ngithub.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0000f2090, 0xc015504200, 0x696520, 0xc015504200)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:184 +0x35 fp=0xc00fa7dfc0 sp=0xc00fa7df98 pc=0x65f725\r\nruntime.goexit()\r\n/usr/local/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc00fa7dfc8 sp=0xc00fa7dfc0 pc=0x458621\r\ncreated by github.com/valyala/fasthttp.(*workerPool).getCh\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:183 +0x119\r\n\r\ngoroutine 1 [runnable]:\r\nsyscall.Syscall6(0x36, 0x7, 0x6, 0x1, 0xc00fa7bb5c, 0x4, 0x0, 0x0, 0x1, 0x0)\r\n/usr/local/go/src/syscall/asm_linux_amd64.s:44 +0x5\r\nsyscall.setsockopt(0x7, 0x6, 0x1, 0xc00fa7bb5c, 0x4, 0xc00fa7bb80, 0x18)\r\n/usr/local/go/src/syscall/zsyscall_linux_amd64.go:1591 +0x79\r\nsyscall.SetsockoptInt(0x7, 0x6, 0x1, 0x1, 0x7f145babdd80, 0x0)\r\n/usr/local/go/src/syscall/syscall_unix.go:285 +0x5b\r\ninternal/poll.(*FD).SetsockoptInt(0xc017a61f80, 0x6, 0x1, 0x1, 0x0, 0x0)\r\n/usr/local/go/src/internal/poll/sockopt.go:17 +0xa0\r\nnet.setNoDelay(0xc017a61f80, 0xc01766c501, 0xc0500fb980, 0x406e75)\r\n/usr/local/go/src/net/tcpsockopt_posix.go:15 +0x50\r\nnet.newTCPConn(0xc017a61f80, 0xc017a61f80)\r\n/usr/local/go/src/net/tcpsock.go:195 +0x56\r\nnet.(*TCPListener).accept(0xc00000e028, 0xc01483c300, 0xc00fa7bcf8, 0x406bcf)\r\n/usr/local/go/src/net/tcpsock_posix.go:143 +0x68\r\nnet.(*TCPListener).Accept(0xc00000e028, 0x0, 0xc01834e650, 0x0, 0xc00fa7bd30)\r\n/usr/local/go/src/net/tcpsock.go:260 +0x47\r\ngithub.com/valyala/fasthttp.acceptConn(0xc0000a41a0, 0x762840, 0xc00000e028, 0xc00fa7be40, 0x763bc0, 0xc01834e650, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1625 +0x49\r\ngithub.com/valyala/fasthttp.(*Server).Serve(0xc0000a41a0, 0x762840, 0xc00000e028, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1547 +0x2bd\r\ngithub.com/valyala/fasthttp.(*Server).ListenAndServe(0xc0000a41a0, 0x710402, 0x3, 0x6a33c0, 0xc054e3e040)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1340 +0xa7\r\ngithub.com/valyala/fasthttp.ListenAndServe(0x710402, 0x3, 0x725680, 0x13d620, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:91 +0x60\r\nmain.main()\r\n/root/go/src/dumb/main.go:537 +0x174\r\n\r\ngoroutine 19 [sleep]:\r\ntime.Sleep(0x3b9aca00)\r\n/usr/local/go/src/runtime/time.go:105 +0x14f\r\ngithub.com/valyala/fasthttp.init.0.func1()\r\n/root/go/src/github.com/valyala/fasthttp/header.go:1441 +0x2a\r\ncreated by github.com/valyala/fasthttp.init.0\r\n/root/go/src/github.com/valyala/fasthttp/header.go:1439 +0x3a\r\n\r\ngoroutine 22 [sleep]:\r\ntime.Sleep(0x2540be400)\r\n/usr/local/go/src/runtime/time.go:105 +0x14f\r\ngithub.com/valyala/fasthttp.(*workerPool).Start.func1(0xc0000f2090, 0xc00006e240)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:61 +0x57\r\ncreated by github.com/valyala/fasthttp.(*workerPool).Start\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:53 +0x7f\r\n\r\ngoroutine 2009 [chan receive]:\r\ngithub.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0000f2090, 0xc00df3b500)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:207 +0x6e\r\ngithub.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0000f2090, 0xc00df3b500, 0x696520, 0xc00df3b500)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:184 +0x35\r\ncreated by github.com/valyala/fasthttp.(*workerPool).getCh\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:183 +0x119\r\n\r\ngoroutine 1695 [runnable]:\r\ngithub.com/valyala/fasthttp.(*Request).ResetBody(0xc00d262000)\r\n/root/go/src/github.com/valyala/fasthttp/http.go:578 +0xb6\r\ngithub.com/valyala/fasthttp.(*Request).resetSkipHeader(0xc00d262000)\r\n/root/go/src/github.com/valyala/fasthttp/http.go:798 +0x2f\r\ngithub.com/valyala/fasthttp.(*Request).Reset(0xc00d262000)\r\n/root/go/src/github.com/valyala/fasthttp/http.go:794 +0x3b\r\ngithub.com/valyala/fasthttp.(*Server).serveConn(0xc0000a41a0, 0x763bc0, 0xc01834e648, 0x0, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1941 +0x7c4\r\ngithub.com/valyala/fasthttp.(*Server).serveConn-fm(0x763bc0, 0xc01834e648, 0x1, 0x0)\r\n/root/go/src/github.com/valyala/fasthttp/server.go:1531 +0x3e\r\ngithub.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0000f2090, 0xc00deba440)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:212 +0xc3\r\ngithub.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc0000f2090, 0xc00deba440, 0x696520, 0xc00deba440)\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:184 +0x35\r\ncreated by github.com/valyala/fasthttp.(*workerPool).getCh\r\n/root/go/src/github.com/valyala/fasthttp/workerpool.go:183 +0x119\r\n"},"comment":{"url":"https://api.github.com/repos/valyala/fasthttp/issues/comments/450646613","html_url":"https://github.com/valyala/fasthttp/issues/506#issuecomment-450646613","issue_url":"https://api.github.com/repos/valyala/fasthttp/issues/506","id":450646613,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDY0NjYxMw==","user":{"login":"erikdubbelboer","id":522870,"node_id":"MDQ6VXNlcjUyMjg3MA==","avatar_url":"https://avatars3.githubusercontent.com/u/522870?v=4","gravatar_id":"","url":"https://api.github.com/users/erikdubbelboer","html_url":"https://github.com/erikdubbelboer","followers_url":"https://api.github.com/users/erikdubbelboer/followers","following_url":"https://api.github.com/users/erikdubbelboer/following{/other_user}","gists_url":"https://api.github.com/users/erikdubbelboer/gists{/gist_id}","starred_url":"https://api.github.com/users/erikdubbelboer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikdubbelboer/subscriptions","organizations_url":"https://api.github.com/users/erikdubbelboer/orgs","repos_url":"https://api.github.com/users/erikdubbelboer/repos","events_url":"https://api.github.com/users/erikdubbelboer/events{/privacy}","received_events_url":"https://api.github.com/users/erikdubbelboer/received_events","type":"User","site_admin":false},"created_at":"2018-12-31T13:36:04Z","updated_at":"2018-12-31T13:36:04Z","author_association":"COLLABORATOR","body":"I don't think this has anything to do with fasthttp. It's hard to see from just these stack traces but it looks like maybe your `UpdateHandler` and `NewHandler` are trying to read from and write to the same map without a mutex?"}}
{"actor":{"display_login":"erikdubbelboer"}}