```js
unexpected fault address 0x7fbb1402ca68
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7fbb1402ca68 pc=0x7fbb1402ca68]
goroutine 17 [running, locked to thread]:
runtime.throw(0x67c5f8, 0x5)
/usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc000143d58 sp=0xc000143d28 pc=0x4358d2
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:702 +0x3cc fp=0xc000143d88 sp=0xc000143d58 pc=0x44aeac
github.com/lianqin/gas/netsdk.export_fAnalyzerDataCallBack(0x1e2b270, 0xc000000017, 0x7fbb1402bb60, 0x7fbb1ca3d375, 0x59aa1, 0xc00000e2e0, 0x7fbb00000002, 0x0, 0x48)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/netsdk/NetSDK.go:114 +0x71 fp=0xc000143dd8 sp=0xc000143d88 pc=0x604f71
github.com/lianqin/gas/netsdk._cgoexpwrap_d9997b9e7408_export_fAnalyzerDataCallBack(0x1e2b270, 0x7fbb00000017, 0x7fbb1402bb60, 0x7fbb1ca3d375, 0x7fbb00059aa1, 0xc00000e2e0, 0x7fbb00000002, 0x0, 0x7fbb14031f30)
_cgo_gotypes.go:983 +0x74 fp=0xc000143e30 sp=0xc000143dd8 pc=0x6044f4
runtime.call128(0x0, 0x7fbb2b7fd7a0, 0x7fbb2b7fd840, 0x48)
/usr/local/go/src/runtime/asm_amd64.s:541 +0x52 fp=0xc000143ec0 sp=0xc000143e30 pc=0x4627f2
runtime.cgocallbackg1(0x0)
/usr/local/go/src/runtime/cgocall.go:332 +0x188 fp=0xc000143f58 sp=0xc000143ec0 pc=0x406b68
runtime.cgocallbackg(0x0)
/usr/local/go/src/runtime/cgocall.go:207 +0xc1 fp=0xc000143fc0 sp=0xc000143f58 pc=0x406941
runtime.cgocallback_gofunc(0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/runtime/asm_amd64.s:793 +0x9b fp=0xc000143fe0 sp=0xc000143fc0 pc=0x463cab
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000143fe8 sp=0xc000143fe0 pc=0x464431
goroutine 1 [semacquire, 960 minutes]:
sync.runtime_Semacquire(0xc0000163c8)
/usr/local/go/src/runtime/sema.go:56 +0x42
sync.(*WaitGroup).Wait(0xc0000163c0)
/usr/local/go/src/sync/waitgroup.go:130 +0x64
main.start(0xc00003ff68, 0x1)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:494 +0x186
main.main()
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:537 +0x67
goroutine 6 [select, 960 minutes]:
database/sql.(*DB).connectionOpener(0xc000120000, 0x6cfd00, 0xc000056040)
/usr/local/go/src/database/sql/sql.go:1052 +0xe8
created by database/sql.OpenDB
/usr/local/go/src/database/sql/sql.go:722 +0x15d
goroutine 7 [select]:
database/sql.(*DB).connectionResetter(0xc000120000, 0x6cfd00, 0xc000056040)
/usr/local/go/src/database/sql/sql.go:1065 +0xfb
created by database/sql.OpenDB
/usr/local/go/src/database/sql/sql.go:723 +0x193
goroutine 12 [select, 960 minutes]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1(0xc000058480, 0xc000102240, 0xc0000641e0)
/home/tmac/Desktop/摄像/go_netsdk/pkg/mod/github.com/go-sql-driver/mysql@v1.5.0/connection.go:621 +0xbf
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
/home/tmac/Desktop/摄像/go_netsdk/pkg/mod/github.com/go-sql-driver/mysql@v1.5.0/connection.go:618 +0xbe
goroutine 10 [IO wait, 2 minutes]:
internal/poll.runtime_pollWait(0x7fbb30890e38, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc000122218, 0x72, 0x100, 0x100, 0xffffffffffffffff)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000122200, 0xc00008c700, 0x100, 0x100, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
net.(*netFD).Read(0xc000122200, 0xc00008c700, 0x100, 0x100, 0xc000041f48, 0x44bbac, 0x100)
/usr/local/go/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000184000, 0xc00008c700, 0x100, 0x100, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:184 +0x8e
main.ledSocketInit()
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:361 +0x14d
created by main.start
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:491 +0x156
goroutine 11 [IO wait]:
internal/poll.runtime_pollWait(0x7fbb30890f18, 0x72, 0xffffffffffffffff)
/usr/local/go/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc000198118, 0x72, 0x100, 0x100, 0xffffffffffffffff)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc000198100, 0xc00048c100, 0x100, 0x100, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:169 +0x19b
net.(*netFD).Read(0xc000198100, 0xc00048c100, 0x100, 0x100, 0xc000505208, 0x44bbac, 0x100)
/usr/local/go/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00009e008, 0xc00048c100, 0x100, 0x100, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:184 +0x8e
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:409 +0x181
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
..............
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
main.etcSocketInit(0xc000120000)
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:444 +0x552
created by main.start
/home/tmac/Desktop/摄像/go_netsdk/src/gas/main.go:493 +0x178
```
程序跑个一两天就会发生这样的事情,这个是死锁问题吗?
我主程序是类似于这样的一个,
```go
var wg sync.WaitGroup
wg.Add(3)
// 调用第三方摄像 sdk
go func() {
err = CameraInit(outsideIp, mysql)
if err != nil {
for {
err = CameraInit(outsideIp, mysql)
if err != nil {
time.Sleep(time.Duration(5) * time.Second)
continue
}
break
}
}
}()
// xxx 设备 socket 通信
go xxxSocketInit( )
// yyy 设备 socket 通信
go yyySocketInit(mysql)
wg.Wait()
```
下面两个 socket 都没有用 sync, 第一个调用第三方的摄像sdk,只有调用功能,不清楚问题出在哪里
你可以尝试在各个 设备 socket 通信 协程中调用recover()处理异常防止程序退出(假如异常不影响程序继续运行),从报错上看可以重点排查sdk中执行c调go函数是否支持空指针(export_fAnalyzerDataCallBack函数中是否都正确处理空指针)
#1
更多评论