panic on Ubuntu 20.04.3 LTS (kernel version 5.4.0-91-generic)
Closed this issue · 0 comments
jzwlqx commented
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc26c8c]
goroutine 71 [running]:
github.com/alibaba/kubeskoop/pkg/exporter/probe/procsock.getHostTCPSockstat()
/root/kubeskoop/pkg/exporter/probe/procsock/procsock.go:181 +0x56c
github.com/alibaba/kubeskoop/pkg/exporter/probe/procsock.collect()
/root/kubeskoop/pkg/exporter/probe/procsock/procsock.go:88 +0xea
github.com/alibaba/kubeskoop/pkg/exporter/probe/procsock.(*ProcSock).CollectOnce(...)
/root/kubeskoop/pkg/exporter/probe/procsock/procsock.go:48
github.com/alibaba/kubeskoop/pkg/exporter/probe.(*legacyBatchMetrics).Collect(0xc0009d5e90, 0xc0000a0600)
/root/kubeskoop/pkg/exporter/probe/legacy.go:113 +0x9e
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
/root/go/pkg/mod/github.com/prometheus/client_golang@v1.15.1/prometheus/registry.go:455 +0x105
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather in goroutine 66
/root/go/pkg/mod/github.com/prometheus/client_golang@v1.15.1/prometheus/registry.go:547 +0xbab
Below is example of /proc/net/sockstat6
TCP6: inuse 0
UDP6: inuse 1
UDPLITE6: inuse 0
RAW6: inuse 1
FRAG6: inuse 0 memory 0
Code:
res.InUse += stat6.Protocols[idx].InUse
res.Orphan += *stat6.Protocols[idx].Orphan // Orphan is nil
res.Alloc += *stat6.Protocols[idx].Alloc // Alloc is nil
res.TW += *stat6.Protocols[idx].TW
res.Mem += *stat6.Protocols[idx].Mem