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: cgo panic, unexpected signal during runtime execution #26961

Closed
garyquan opened this issue Aug 13, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@garyquan
Copy link

commented Aug 13, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7.6 linux/386

Does this issue reproduce with the latest release?

I'm not exactly

What operating system and processor architecture are you using (go env)?

GOARCH="386"
GOBIN=""
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_386"
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build948719345=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4 pc=0x389b90]

runtime stack:
runtime.throw(0x42ad93, 0x2a)
/usr/local/go/src/runtime/panic.go:566 +0x78
runtime.sigpanic()
/usr/local/go/src/runtime/sigpanic_unix.go:12 +0x44

goroutine 9 [syscall, locked to thread]:
runtime.cgocall(0x389604, 0x1083fe7c, 0x0)
/usr/local/go/src/runtime/cgocall.go:131 +0x130 fp=0x1083fe5c sp=0x1083fe40
main._Cfunc_snmpget(0x416057a8, 0x0)
??:0 +0x3c fp=0x1083fe78 sp=0x1083fe5c
main.snmpDevGetTimer(0x3ac478, 0x109b1f80)
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/polling.go:244 +0xe4 fp=0x1083febc sp=0x1083fe78
timer.runCallback(0x45c91c, 0x3ac478, 0x109b1f80)
/home/source/source/switch/apps/snmp_passthrough/src/timer/timer.go:193 +0x5c fp=0x1083fecc sp=0x1083febc
timer.Tick()
/home/source/source/switch/apps/snmp_passthrough/src/timer/timer.go:156 +0x1fc fp=0x1083ffb8 sp=0x1083fecc
timer.selfTickRoutine(0x3b9aca00, 0x0)
/home/source/source/switch/apps/snmp_passthrough/src/timer/timer.go:181 +0x28 fp=0x1083ffc4 sp=0x1083ffb8
runtime.goexit()
/usr/local/go/src/runtime/asm_arm.s:998 +0x4 fp=0x1083ffc4 sp=0x1083ffc4
created by timer.StartTicks
/home/source/source/switch/apps/snmp_passthrough/src/timer/timer.go:175 +0x34

goroutine 1 [select, 2116 minutes]:
sundray.com/mqttappGw.(*mqttClient).mqttClientLoop(0x5aacc8)
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:479 +0x3c0
sundray.com/mqttappGw.Loop()
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttapp.go:90 +0x20
main.main()
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/main.go:227 +0x26c

goroutine 17 [syscall, 2116 minutes, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_arm.s:998 +0x4

goroutine 5 [chan receive]:
github.com/surge/glog.(*loggingT).flushDaemon(0x5aaf38)
/home/source/source/3party/golang/src/github.com/surge/glog/glog.go:896 +0x60
created by github.com/surge/glog.init.1
/home/source/source/3party/golang/src/github.com/surge/glog/glog.go:410 +0x1ec

goroutine 6 [syscall, 2116 minutes]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:116 +0x190
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x14
created by os/signal.init.1
/usr/local/go/src/os/signal/signal_unix.go:28 +0x30

goroutine 10 [IO wait, 2116 minutes]:
net.runtime_pollWait(0x41518e58, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0x10812b78, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x34
net.(*pollDesc).waitRead(0x10812b78, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x30
net.(*netFD).accept(0x10812b40, 0x0, 0x594088, 0x1088be50)
/usr/local/go/src/net/fd_unix.go:419 +0x21c
net.(*TCPListener).accept(0x1080c780, 0x0, 0x0, 0x0)
/usr/local/go/src/net/tcpsock_posix.go:132 +0x30
net.(*TCPListener).AcceptTCP(0x1080c780, 0x58d700, 0x0, 0x0)
/usr/local/go/src/net/tcpsock.go:209 +0x9c
net/http.tcpKeepAliveListener.Accept(0x1080c780, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2608 +0x3c
net/http.(*Server).Serve(0x108105a0, 0x595f10, 0x1080c780, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2273 +0x200
net/http.(*Server).ListenAndServe(0x108105a0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2219 +0xf4
net/http.ListenAndServe(0x41762b, 0x6, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2351 +0x90
main.main.func1()
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/main.go:201 +0x48
created by main.main
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/main.go:202 +0x24

goroutine 11 [IO wait, 2116 minutes]:
net.runtime_pollWait(0x41518f48, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0x10812378, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x34
net.(*pollDesc).waitRead(0x10812378, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x30
net.(*netFD).readFrom(0x10812340, 0x1088bd10, 0x8, 0x8, 0x0, 0x0, 0x0, 0x5948f8, 0x1080e090)
/usr/local/go/src/net/fd_unix.go:270 +0x20c
net.(*UDPConn).readFrom(0x1080c578, 0x1088bd10, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/udpsock_posix.go:43 +0x54
net.(*UDPConn).ReadFromUDP(0x1080c578, 0x1088bd10, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/udpsock.go:85 +0xc8
sundray.com/mqttlogGw.listenMultiCastPacket.func1(0x1088bd10, 0x8, 0x8, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/sundray.com/mqttlogGw/mqttlog.go:280 +0xbc
created by sundray.com/mqttlogGw.listenMultiCastPacket
/home/source/source/switch/commonsrc/src/sundray.com/mqttlogGw/mqttlog.go:306 +0xf0

goroutine 30 [chan receive]:
sundray.com/mqttappGw.(*mqttClient).subHandler(0x5aacc8, 0x109b1c00, 0x45c908)
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:169 +0xf4
created by sundray.com/mqttappGw.(*mqttClient).mqttClientSub
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:252 +0x1c0

goroutine 13 [select]:
sundray.com/timerGw.timeTicker()
/home/source/source/switch/commonsrc/src/sundray.com/timerGw/ticker.go:51 +0x334
created by sundray.com/timerGw.startTicker.func1
/home/source/source/switch/commonsrc/src/sundray.com/timerGw/ticker.go:25 +0x8c

goroutine 14 [semacquire]:
sync.runtime_notifyListWait(0x108154c8, 0x2bde)
/usr/local/go/src/runtime/sema.go:267 +0x1d8
sync.(*Cond).Wait(0x108154c0)
/usr/local/go/src/sync/cond.go:57 +0xc4
github.com/surgemq/surgemq/service.(*buffer).ReadWait(0x108645a0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/buffer.go:408 +0x210
github.com/surgemq/surgemq/service.(*service).peekMessageSize(0x1086c120, 0x597300, 0x10810460, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/sendrecv.go:168 +0x138
github.com/surgemq/surgemq/service.(*service).processor(0x1086c120)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/process.go:65 +0x1f8
created by github.com/surgemq/surgemq/service.(*service).start
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/service.go:181 +0x444

goroutine 15 [runnable]:
net.runtime_pollWait(0x41518ed0, 0x72, 0x10946f42)
/usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0x10812af8, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x34
net.(*pollDesc).waitRead(0x10812af8, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x30
net.(*netFD).Read(0x10812ac0, 0x10946f42, 0x10be, 0x10be, 0x0, 0x5948f8, 0x1080e090)
/usr/local/go/src/net/fd_unix.go:243 +0x1f0
net.(*conn).Read(0x1080c798, 0x10946f42, 0x10be, 0x10be, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:173 +0xb8
github.com/surgemq/surgemq/service.timeoutReader.Read(0xf46b0400, 0x14, 0x4151f228, 0x1080c798, 0x10946f42, 0x10be, 0x10be, 0x0, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/sendrecv.go:42 +0x1ec
github.com/surgemq/surgemq/service.(*timeoutReader).Read(0x1088bf40, 0x10946f42, 0x10be, 0x10be, 0x2000, 0x0, 0x0)
:3 +0xbc
github.com/surgemq/surgemq/service.(*buffer).ReadFrom(0x108645a0, 0x594460, 0x1088bf40, 0x0, 0x0, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/buffer.go:158 +0x1f8
github.com/surgemq/surgemq/service.(*service).receiver(0x1086c120)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/sendrecv.go:79 +0x404
created by github.com/surgemq/surgemq/service.(*service).start
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/service.go:187 +0x4c0

goroutine 16 [semacquire]:
sync.runtime_notifyListWait(0x10815508, 0x2bfe)
/usr/local/go/src/runtime/sema.go:267 +0x1d8
sync.(*Cond).Wait(0x10815500)
/usr/local/go/src/sync/cond.go:57 +0xc4
github.com/surgemq/surgemq/service.(*buffer).ReadPeek(0x10864660, 0x2000, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/buffer.go:337 +0x204
github.com/surgemq/surgemq/service.(*buffer).WriteTo(0x10864660, 0x593d28, 0x1080c798, 0x0, 0x0, 0x0, 0x0)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/buffer.go:184 +0xcc
github.com/surgemq/surgemq/service.(*service).sender(0x1086c120)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/sendrecv.go:125 +0x2e4
created by github.com/surgemq/surgemq/service.(*service).start
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/service.go:192 +0x53c

goroutine 18 [select]:
github.com/surgemq/surgemq/service.(*service).ackProcessor(0x1086c120, 0x10812d00)
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/process.go:225 +0x15c
created by github.com/surgemq/surgemq/service.(*service).processor
/home/source/source/switch/commonsrc/src/github.com/surgemq/surgemq/service/process.go:57 +0x18c

goroutine 19 [select]:
sundray.com/netmqGw.(*Netmq).pingServer(0x1088c400)
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:459 +0x36c
created by sundray.com/netmqGw.(*Netmq).Init
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:241 +0x268

goroutine 20 [chan receive, 2116 minutes]:
sundray.com/netmqGw.(*Netmq).connServer(0x1088c400)
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:325 +0xf0
created by sundray.com/netmqGw.(*Netmq).Init
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:242 +0x284

goroutine 21 [chan receive, 616 minutes]:
sundray.com/netmqGw.(*Netmq).subServer(0x1088c400)
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:527 +0x90
created by sundray.com/netmqGw.(*Netmq).Init
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:243 +0x2a0

goroutine 22 [select, 2116 minutes]:
sundray.com/netmqGw.(*Netmq).connMonitorForSurgemq(0x1088c400)
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:294 +0x350
created by sundray.com/netmqGw.(*Netmq).Init
/home/source/source/switch/commonsrc/src/sundray.com/netmqGw/netmq.go:244 +0x2bc

goroutine 23 [chan receive, 616 minutes]:
sundray.com/mqttappGw.(*mqttClient).subHandler(0x5aacc8, 0x10812dc0, 0x45c910)
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:169 +0xf4
created by sundray.com/mqttappGw.(*mqttClient).mqttClientSub
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:252 +0x1c0

goroutine 24 [chan receive, 616 minutes]:
sundray.com/mqttappGw.(*mqttClient).subHandler(0x5aacc8, 0x10812e00, 0x45c90c)
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:169 +0xf4
created by sundray.com/mqttappGw.(*mqttClient).mqttClientSub
/home/source/source/switch/commonsrc/src/sundray.com/mqttappGw/mqttclient.go:252 +0x1c0

goroutine 25 [select, 616 minutes]:
main.snmpDaemon()
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/main.go:181 +0xb4
created by main.main
/home/source/source/switch/apps/snmp_passthrough/src/snmp_passthrough/main.go:224 +0x240

goroutine 26 [select, 2116 minutes, locked to thread]:
runtime.gopark(0x45cd14, 0x0, 0x41837b, 0x6, 0x18, 0x2)
/usr/local/go/src/runtime/proc.go:259 +0x148
runtime.selectgoImpl(0x108a5790, 0x0, 0xc)
/usr/local/go/src/runtime/select.go:423 +0x13a8
runtime.selectgo(0x108a5790)
/usr/local/go/src/runtime/select.go:238 +0x10
runtime.ensureSigM.func1()
/usr/local/go/src/runtime/signal1_unix.go:304 +0x428
runtime.goexit()
/usr/local/go/src/runtime/asm_arm.s:998 +0x4

What did you expect to see?

no panic

What did you see instead?

@andybons

This comment has been minimized.

Copy link
Member

commented Aug 13, 2018

This is a rather old version of Go. Does this reproduce on the latest stable version? Without a reliable repro it's difficult to get to the root of the cause, especially with cgo issues.

@andybons andybons added this to the Unplanned milestone Aug 13, 2018

@ianlancetaylor ianlancetaylor changed the title cgo panic, unexpected signal during runtime execution runtime: cgo panic, unexpected signal during runtime execution Aug 13, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2018

At a quick glance this looks like a NULL pointer dereference in C code. You should double check that you aren't passing a Go nil pointer in your cgo call.

@gopherbot

This comment has been minimized.

Copy link

commented Sep 13, 2018

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Sep 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.