golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.1k stars 17.68k forks source link

panic: runtime: frame runtime.memeq untyped args #10678

Closed bjsuo closed 9 years ago

bjsuo commented 9 years ago

panic: runtime: frame runtime.memeq untyped args 0xc3d5b793b8+0x19 panic during panic

runtime stack: runtime.startpanic_m() /usr/local/go/src/runtime/panic.c:110 +0x108 runtime.onM(0x88f950) /usr/local/go/src/runtime/asm_amd64.s:273 +0x9a runtime.startpanic() /usr/local/go/src/runtime/panic.go:469 +0x14 runtime.throw(0x9aafd1) /usr/local/go/src/runtime/panic.go:489 +0x35 adjustframe(0x7fbcc76b0c78, 0x7fbcc76b0d48, 0x1) /usr/local/go/src/runtime/stack.c:525 +0x348 runtime.gentraceback(0x42a0d0, 0xc3d5b791d8, 0x0, 0xc3a9cfc120, 0x0, 0x0, 0x7fffffff, 0x7fbcc76b0d38, 0x7fbcc76b0d48, 0x0, ...) /usr/local/go/src/runtime/traceback.go:311 +0x7a8 copystack(0xc3a9cfc120, 0x1000) /usr/local/go/src/runtime/stack.c:623 +0x177 runtime.newstack() /usr/local/go/src/runtime/stack.c:789 +0x575 runtime.morestack() /usr/local/go/src/runtime/asm_amd64.s:324 +0x7e

goroutine 234435653 [stack growth]: runtime.assertE2I2(0x73e960, 0x75fa40, 0xc20802a050, 0x4320de, 0x2, 0x7dc3b0) /usr/local/go/src/runtime/iface.go:372 fp=0xc3d5b791e0 sp=0xc3d5b791d8 runtime.printany(0x75fa40, 0xc20802a050) /usr/local/go/src/runtime/error.go:88 +0xb4 fp=0xc3d5b792b0 sp=0xc3d5b791e0 runtime.printpanics(0xc2ea399b00) /usr/local/go/src/runtime/panic.go:310 +0x8a fp=0xc3d5b792c8 sp=0xc3d5b792b0 runtime.gopanic(0x75fa40, 0xc20802a050) /usr/local/go/src/runtime/panic.go:424 +0x296 fp=0xc3d5b79330 sp=0xc3d5b792c8 runtime.panicmem() /usr/local/go/src/runtime/panic.go:42 +0x4e fp=0xc3d5b79358 sp=0xc3d5b79330 runtime.sigpanic() /usr/local/go/src/runtime/sigpanic_unix.go:26 +0x274 fp=0xc3d5b793a8 sp=0xc3d5b79358 runtime.memeqbody() /usr/local/go/src/runtime/asm_amd64.s:1104 +0x74 fp=0xc3d5b793b0 sp=0xc3d5b793a8 runtime.memeq(0x0, 0xc442734680, 0x31) /usr/local/go/src/runtime/asm_amd64.s:1038 +0x14 fp=0xc3d5b793b8 sp=0xc3d5b793b0 runtime.mapaccess2_faststr(0x6c1900, 0xc20803cff0, 0xc442734680, 0x31, 0x0, 0xc47c2b6ac0) /usr/local/go/src/runtime/hashmap_fast.go:370 +0x504 fp=0xc3d5b79418 sp=0xc3d5b793b8

go version go1.4.2 linux/amd64

davecheney commented 9 years ago

Thank you for your error report.

How did you trigger this ? Can you provide some sample code that reproduces the problem.

Looking at the traceback I see maps involved. If you have a data race in your program it is very common that you can corrupt the map structures. Have you checked that there are no data races in your program with the race detector ?

randall77 commented 9 years ago

It certainly smells like corruption. The code is comparing two strings for equality, but one of them has a nil data pointer. Strings should never have nil data pointers (unless they have 0 length, which these strings don't).

Ideally this situation should trigger a better error, maybe a nil pointer panic instead of a "stack not copyable" error. But it is not clear whether any additional code is worth it in cases of corruption.

bjsuo commented 9 years ago

Yes ,the program has a data race ,but I have used lock already. The code is

    n.Lock()
    defer n.Unlock() 
    n.clientMap[client.LongIdentifier] = client
davecheney commented 9 years ago

If you cannot reproduce the crash after correcting the race, please close the issue.

Thanks

Dave

On Tue, 5 May 2015 13:29 bjsuo notifications@github.com wrote:

Yes ,the program has a data race ,but I used lock already. The code is n.Lock() defer n.Unlock()

n.clientMap[client.LongIdentifier] = client

— Reply to this email directly or view it on GitHub https://github.com/golang/go/issues/10678#issuecomment-98927170.