Closed cristian-sima closed 8 years ago
hi @cristian-sima it is a bug. read and write static file map error:
staticFileMap = make(map[string]*serveContentHolder)
and @astaxie Maybe need to modify the static file server logic has to ensure efficient and safe.
@astaxie Can you please fix this bug. It is really difficult to stop and start the server for 20 times per day. Thanks
I have come across this problem too. my go version is go1.6 and my system is mac osx 10.11.3 (15D21)
I use the bee command to create a project named beegoDemo
$ bee new beegoDemo
and then run the project then, use ab to benchmark
$ ab -n 10000 -c 10 http://localhost:8080/
And the problem appeared
`fatal error: concurrent map read and map write
goroutine 407 [running]: runtime.throw(0x6a1a80, 0x21) /usr/local/go/src/runtime/panic.go:530 +0x90 fp=0xc820341478 sp=0xc820341460 runtime.mapaccess1_faststr(0x476ce0, 0xc82012c210, 0x62b810, 0x9, 0xc8201058e8) /usr/local/go/src/runtime/hashmap_fast.go:202 +0x5b fp=0xc8203414d8 sp=0xc820341478 github.com/astaxie/beego.(_Controller).RenderBytes(0xc8201c31e0, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/liwei/Documents/mygo/src/github.com/astaxie/beego/controller.go:265 +0x1893 fp=0xc820341760 sp=0xc8203414d8 github.com/astaxie/beego.(_Controller).Render(0xc8201c31e0, 0x0, 0x0) /Users/liwei/Documents/mygo/src/github.com/astaxie/beego/controller.go:183 +0x4e fp=0xc8203417c0 sp=0xc820341760 github.com/astaxie/beego.(_ControllerRegister).ServeHTTP(0xc82012c300, 0xd900d0, 0xc8201c2f70, 0xc820346000) /Users/liwei/Documents/mygo/src/github.com/astaxie/beego/router.go:784 +0x1d7c fp=0xc820341b60 sp=0xc8203417c0 net/http.serverHandler.ServeHTTP(0xc82007c180, 0xd900d0, 0xc8201c2f70, 0xc820346000) /usr/local/go/src/net/http/server.go:2081 +0x19e fp=0xc820341bc0 sp=0xc820341b60 net/http.(_conn).serve(0xc82007d100) /usr/local/go/src/net/http/server.go:1472 +0xf2e fp=0xc820341f88 sp=0xc820341bc0 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820341f90 sp=0xc820341f88 created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2137 +0x44e
goroutine 1 [chan receive]: github.com/astaxie/beego.(*App).Run(0xc82000b5c0) /Users/liwei/Documents/mygo/src/github.com/astaxie/beego/app.go:182 +0xabb github.com/astaxie/beego.Run(0x0, 0x0, 0x0) /Users/liwei/Documents/mygo/src/github.com/astaxie/beego/beego.go:67 +0x163 main.main() /Users/liwei/Documents/mygo/src/beegoDemo/main.go:9 +0x28
goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1
goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/local/go/src/runtime/sigqueue.go:116 +0x132 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:22 +0x18 created by os/signal.init.1 /usr/local/go/src/os/signal/signal_unix.go:28 +0x37`
@iyidan Just in DEV mode .
it's fixed in develop branch
@astaxie curious.. what was the fix?
@shiv123 this commit https://github.com/astaxie/beego/commit/226e54e0d8d81b287a67949d9559572be5ccc363
I recently upgraded to Go 1.6 and SOMETIMES (I have no clues why) my server crashes with this log.
I think it is because Go 1.6 introduces the detection of concurrent map write and read (more here)
Here is the full log of the problem