Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: fatal error: bad map state #10754

Closed
woshicixide opened this issue May 8, 2015 · 6 comments
Closed

runtime: fatal error: bad map state #10754

woshicixide opened this issue May 8, 2015 · 6 comments

Comments

@woshicixide
Copy link

fatal error: bad map state

goroutine 250603 [running]:
runtime.gothrow(0x6d3010, 0xd)
/usr/local/go/src/runtime/panic.go:503 +0x8e fp=0xc2080b0740 sp=0xc2080b0728
runtime.evacuate(0x600d60, 0xc20803ca80, 0x194a)
/usr/local/go/src/runtime/hashmap.go:791 +0x370 fp=0xc2080b0800 sp=0xc2080b0740
runtime.growWork(0x600d60, 0xc20803ca80, 0x73d)
/usr/local/go/src/runtime/hashmap.go:761 +0x8a fp=0xc2080b0820 sp=0xc2080b0800
runtime.mapassign1(0x600d60, 0xc20803ca80, 0xc2080b0998, 0xc2080b0988)
/usr/local/go/src/runtime/hashmap.go:401 +0x190 fp=0xc2080b08c0 sp=0xc2080b0820
Counter.(_CounterPool).getCounter(0xc2090ad1c0, 0xc20a7ff6b9, 0x1c, 0x554c2401, 0x0, 0x0)
/Users/torun/Documents/Program/go/src/Counter/counter.go:64 +0x532 fp=0xc2080b0a00 sp=0xc2080b08c0
Counter.(_CounterPool).Inc(0xc2090ad1c0, 0xc20a7ff6b9, 0x1c, 0xeccde1b87, 0xc2349326f8, 0x81dae0, 0x1)
/Users/torun/Documents/Program/go/src/Counter/counter.go:26 +0x41 fp=0xc2080b0a48 sp=0xc2080b0a00
Counter.CounterPool.ServeHTTP(0xc20803ca80, 0x0, 0x0, 0x0, 0x2ab83067c0e8, 0xc209e50b40, 0xc209e4ef70)
/Users/torun/Documents/Program/go/src/Counter/counter.go:91 +0x4d9 fp=0xc2080b0c70 sp=0xc2080b0a48
Counter.(_CounterPool).ServeHTTP(0xc20800a4e0, 0x2ab83067c0e8, 0xc209e50b40, 0xc209e4ef70)
:4 +0xbe fp=0xc2080b0cb0 sp=0xc2080b0c70
net/http.serverHandler.ServeHTTP(0xc20804c180, 0x2ab83067c0e8, 0xc209e50b40, 0xc209e4ef70)
/usr/local/go/src/net/http/server.go:1703 +0x19a fp=0xc2080b0d08 sp=0xc2080b0cb0
net/http.(_conn).serve(0xc209b163c0)
/usr/local/go/src/net/http/server.go:1204 +0xb57 fp=0xc2080b0fd8 sp=0xc2080b0d08
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc2080b0fe0 sp=0xc2080b0fd8
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:1751 +0x35e

goroutine 1 [IO wait]:
net.(_pollDesc).Wait(0xc208010140, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(_pollDesc).WaitRead(0xc208010140, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(_netFD).accept(0xc2080100e0, 0x0, 0x2ab830673b70, 0xc2093bc000)
/usr/local/go/src/net/fd_unix.go:419 +0x40b
net.(_TCPListener).AcceptTCP(0xc208042020, 0x45b66e, 0x0, 0x0)
/usr/local/go/src/net/tcpsock_posix.go:234 +0x4e
net/http.tcpKeepAliveListener.Accept(0xc208042020, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1976 +0x4c
net/http.(_Server).Serve(0xc20804c180, 0x2ab83067bf30, 0xc208042020, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1728 +0x92
net/http.(_Server).ListenAndServe(0xc20804c180, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1718 +0x154
net/http.ListenAndServe(0x6bc210, 0x5, 0x2ab83067ae68, 0xc20800a4e0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1808 +0xba
main.main()
/Users/torun/Documents/Program/go/src/teller/teller.go:25 +0x1be

goroutine 157413 [runnable]:
net/http.(_conn).serve(0xc209c4c000)
/usr/local/go/src/net/http/server.go:1124
created by net/http.(_Server).Serve
/usr/local/go/src/net/http/server.go:1751 +0x35e

goroutine 250602 [runnable]:
reflect.Value.MapKeys(0x6013e0, 0xc20a7e6ba0, 0x15, 0x0, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:1040 +0x122
encoding/json.(_mapEncoder).encode(0xc2080ca010, 0xc208e8b970, 0x6013e0, 0xc20a7e6ba0, 0x15, 0x0)
/usr/local/go/src/encoding/json/encode.go:611 +0xda
encoding/json._mapEncoder.(encoding/json.encode)路fm(0xc208e8b970, 0x6013e0, 0xc20a7e6ba0, 0x15, 0xc20a7e6b00)
/usr/local/go/src/encoding/json/encode.go:629 +0x58
encoding/json.(_encodeState).reflectValue(0xc208e8b970, 0x6013e0, 0xc20a7e6ba0, 0x15)
/usr/local/go/src/encoding/json/encode.go:299 +0x72
encoding/json.(_encodeState).marshal(0xc208e8b970, 0x6013e0, 0xc20a7e6ba0, 0x0, 0x0)
/usr/local/go/src/encoding/json/encode.go:270 +0xca
encoding/json.Marshal(0x6013e0, 0xc20a7e6ba0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/encoding/json/encode.go:135 +0x92
Counter.CounterPool.ServeHTTP(0xc20803ca80, 0x0, 0x0, 0x0, 0x2ab83067c0e8, 0xc209b16460, 0xc2086e3380)
/Users/torun/Documents/Program/go/src/Counter/counter.go:98 +0x3a9
Counter.(_CounterPool).ServeHTTP(0xc20800a4e0, 0x2ab83067c0e8, 0xc209b16460, 0xc2086e3380)
:4 +0xbe
net/http.serverHandler.ServeHTTP(0xc20804c180, 0x2ab83067c0e8, 0xc209b16460, 0xc2086e3380)
/usr/local/go/src/net/http/server.go:1703 +0x19a
net/http.(_conn).serve(0xc209b16320)
/usr/local/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:1751 +0x35e

@woshicixide woshicixide changed the title bad map state, anyone have same problem? bad map state May 8, 2015
@adg
Copy link
Contributor

adg commented May 8, 2015

What version of Go are you using (go version)?

What operating system and processor architecture are you using?

What did you do?

What did you expect to see?

What did you see instead?

@randall77
Copy link
Contributor

Did you run with the race detector on? This kind of error often happens when updating a map from several goroutines (from several different http requests?) simultaneously.

@woshicixide
Copy link
Author

goversion:1.4.1
os:linux amd_64

@woshicixide
Copy link
Author

so how can i run with race detector

@minux
Copy link
Member

minux commented May 8, 2015 via email

@bradfitz
Copy link
Contributor

bradfitz commented May 8, 2015

This is almost certainly a race. Closing the bug for now.

Let's move the discussion to the golang-nuts@ mailing list until there's evidence of a Go bug.

@bradfitz bradfitz closed this as completed May 8, 2015
@mikioh mikioh changed the title bad map state runtime: fatal error: bad map state May 8, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants