unexpected fault address; sigpanic_unix

148 views
Skip to first unread message

Alex Howard

unread,
Jul 21, 2015, 9:00:35 PM7/21/15
to golang-nuts

I have no idea how to debug this panic, can anyone point me in the right direction?

I have no idea where it is happening, the last thing I tried to do is http res.Write(b) with a non nil byte slice

ImportAC_# bucket already exists
ImportAC_# IMPORTED 14/14 FILES FROM BOLT DB
AutoHandler_# FOUND CACHED ITEM WITH KEY: ma
unexpected fault address
0x7fd7b62171a7
fatal error
: fault
[signal 0xb code=0x1 addr=0x7fd7b62171a7 pc=0x435e60]

goroutine
21 [running]:
runtime
.gothrow(0x8cf4c0, 0x5)
       
/usr/local/go/src/runtime/panic.go:503 +0x8e fp=0xc20835b150 sp=0xc20835b138
runtime
.sigpanic()
       
/usr/local/go/src/runtime/sigpanic_unix.go:29 +0x265 fp=0xc20835b1a0 sp=0xc20835b150
runtime
.memmove(0xc20803d5f0, 0x7fd7b62171a7, 0x87)
       
/usr/local/go/src/runtime/memmove_amd64.s:181 +0x1f0 fp=0xc20835b1a8 sp=0xc20835b1a0
runtime
.slicebytetostring(0x7fd7b62171a7, 0x87, 0x7fffffff, 0x0, 0x0)
       
/usr/local/go/src/runtime/string.go:70 +0xd1 fp=0xc20835b238 sp=0xc20835b1a8
fmt
.(*pp).fmtBytes(0xc208033040, 0x7fd7b62171a7, 0x87, 0x7fffffff, 0x73, 0x0, 0x0, 0x0)
       
/usr/local/go/src/fmt/print.go:563 +0x142 fp=0xc20835b468 sp=0xc20835b238
fmt
.(*pp).printArg(0xc208033040, 0x764920, 0xc208158dc0, 0x73, 0x0, 0x0)
       
/usr/local/go/src/fmt/print.go:790 +0x517 fp=0xc20835b538 sp=0xc20835b468
fmt
.(*pp).doPrintf(0xc208033040, 0x8bdd40, 0x2, 0xc20835ba60, 0x1, 0x1)
       
/usr/local/go/src/fmt/print.go:1183 +0x21cd fp=0xc20835b8c8 sp=0xc20835b538
fmt
.Fprintf(0x7fd7b63c34c0, 0xc208316a00, 0x8bdd40, 0x2, 0xc20835ba60, 0x1, 0x1, 0x7fd7b63bb8a8, 0x0, 0x0)
       
/usr/local/go/src/fmt/print.go:188 +0x7b fp=0xc20835b910 sp=0xc20835b8c8
main
.AutoHandler(0x7fd7b63c3488, 0xc208316a00, 0xc2083b60d0, 0xc208158d60, 0x1, 0x1)
       
/home/alex/_code/website/server/autocomplete.go:63 +0x35a fp=0xc20835bb80 sp=0xc20835b910
github
.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc208314280, 0x7fd7b63c3488, 0xc208316a00, 0xc2083b60d0)
       
/home/alex/go/src/github.com/julienschmidt/httprouter/router.go:299 +0x18e fp=0xc20835bcb0 sp=0xc20835bb80
net
/http.serverHandler.ServeHTTP(0xc20834a000, 0x7fd7b63c3488, 0xc208316a00, 0xc2083b60d0)
       
/usr/local/go/src/net/http/server.go:1703 +0x19a fp=0xc20835bd08 sp=0xc20835bcb0
net
/http.(*conn).serve(0xc208316960)
       
/usr/local/go/src/net/http/server.go:1204 +0xb57 fp=0xc20835bfd8 sp=0xc20835bd08
runtime
.goexit()
       
/usr/local/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc20835bfe0 sp=0xc20835bfd8
created
by net/http.(*Server).Serve
       
/usr/local/go/src/net/http/server.go:1751 +0x35e



Alex Howard

unread,
Jul 21, 2015, 9:12:00 PM7/21/15
to golang-nuts

I'm running:

go version go1.4.2 linux/amd64

Alex Howard

unread,
Jul 21, 2015, 9:39:56 PM7/21/15
to golang-nuts

Whenever I try to use map[string][]byte I always run into trouble like this.

I had that hunch so for my cache, I changed it from map[string][]byte to map[string]*string, and the program works fine

Does anyone else have a legacy of weird behaviour using map[string][]byte?

Thanks.
...

Ian Lance Taylor

unread,
Jul 22, 2015, 12:35:46 AM7/22/15
to Alex Howard, golang-nuts
On Tue, Jul 21, 2015 at 6:00 PM, Alex Howard <3du...@gmail.com> wrote:
>
> I have no idea how to debug this panic, can anyone point me in the right
> direction?

This looks like memory corruption. Do you use cgo? Do you use
unsafe? Have you tried running your program under the race detector?

Since you mention map[string][]byte, is there a chance that multiple
goroutines are writing to the map simultaneously? The race detector
should be able to detect that.

Ian

Alex B

unread,
Jul 22, 2015, 12:49:08 AM7/22/15
to Ian Lance Taylor, golang-nuts
I'm using struct mutexes for reading the map and writing to it.

l'll take a look at the race detector next time I go with map[string][]byte.

In my case *string was the best idea anyway.



Reply all
Reply to author
Forward
0 new messages