在 2016年9月20日星期二 UTC+8上午3:41:09,Ian Lance Taylor写道: > > On Mon, Sep 19, 2016 at 8:34 AM, Wanghb Wang <wang...@gmail.com > <javascript:>> wrote: > > > > when I use stattcpupprof in my program, I got fatal error malloc > deadlock. > > delete the cpu pprof, the program run well. > > > > > > my question is : > > Does startcpuprof infect the malloc or resulting OOM Problem > > I'm sorry, I don't understand the question. > > > > this is my panic stack trace: > > It looks like you have C code that calls goCbStr. Somehow when that > happens the malloc lock is held for the thread. The only way I can > see that happening is if your C code has a SIGPROF handler that calls > into Go. > > However, I have no SIGPROF handler(you mean sigaction(SIGPROF,&act,NULL)?)
my question is: why I add startcpupprof in my golang program (I did have C calls into Go) result in malloc deadlock? my > > > > fatal error: malloc deadlock > > goroutine 17 [running, locked to thread]: > > runtime.throw(0x845aa0, 0xf) > > C:/Go/src/runtime/panic.go:547 +0x97 fp=0xc082025c68 > sp=0xc082025c50 > > runtime.mallocgc(0x5, 0x0, 0x3, 0x822aa0) > > C:/Go/src/runtime/malloc.go:544 +0x1e1 fp=0xc082025d40 > > sp=0xc082025c68 > > runtime.rawstring(0x5, 0x0, 0x0, 0x0, 0x0, 0x0) > > C:/Go/src/runtime/string.go:284 +0x77 fp=0xc082025d88 > > sp=0xc082025d40 > > runtime.gostring(0x7ff94f7f992c, 0x0, 0x0) > > C:/Go/src/runtime/string.go:341 +0x62 fp=0xc082025df0 > > sp=0xc082025d88 > > main._Cfunc_GoString(0x7ff94f7f992c, 0x0, 0x0) > > test/_obj/_cgo_gotypes.go:44 +0x34 fp=0xc082025e10 > sp=0xc082025df0 > > main.goCbStr(0x1, 0x2, 0x7ff94f7f992c, 0xa20fd0) > > C:/Programming/go-src/src/test/test.go:125 +0x62 fp=0xc082025ed0 > > sp=0xc082025e10 > > runtime.call32(0x0, 0x8eb238, 0x3befdd0, 0x20) > > C:/Go/src/runtime/asm_amd64.s:472 +0x45 fp=0xc082025ef8 > > sp=0xc082025ed0 > > runtime.cgocallbackg1() > > C:/Go/src/runtime/cgocall.go:267 +0x11a fp=0xc082025f30 > > sp=0xc082025ef8 > > runtime.cgocallbackg() > > C:/Go/src/runtime/cgocall.go:180 +0xde fp=0xc082025f90 > > sp=0xc082025f30 > > runtime.cgocallback_gofunc(0x0, 0x0, 0x0) > > C:/Go/src/runtime/asm_amd64.s:716 +0x6d fp=0xc082025fa0 > > sp=0xc082025f90 > > runtime.goexit() > > C:/Go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc082025fa8 > > sp=0xc082025fa0 > > > > goroutine 1 [sleep]: > > time.Sleep(0x3b9aca00) > > C:/Go/src/runtime/time.go:59 +0x107 > > main.main() > > C:/Programming/go-src/src/test/test.go:64 +0x4c3 > > > > goroutine 18 [syscall, locked to thread]: > > runtime.goexit() > > C:/Go/src/runtime/asm_amd64.s:1998 +0x1 > > > > goroutine 6 [syscall]: > > runtime.CPUProfile(0x0, 0x0, 0x0) > > C:/Go/src/runtime/cpuprof.go:421 +0x3b > > runtime/pprof.profileWriter(0x1742f0, 0xc082026038) > > C:/Go/src/runtime/pprof/pprof.go:607 +0x23 > > created by runtime/pprof.StartCPUProfile > > C:/Go/src/runtime/pprof/pprof.go:601 +0x14c > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to golang-nuts...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.