aquasecurity / libbpfgo

eBPF library for Go. Powered by libbpf.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go routine leak

geyslan opened this issue · comments

After libbpfgo.(*BPFLink).Destroy() call.

Detected while tackling tracee integration tests go routine leaks:

leaks.go:78: found unexpected goroutines:
        [Goroutine 421 in state syscall, with github.com/aquasecurity/libbpfgo._Cfunc_bpf_link__destroy on top of the stack:
        goroutine 421 [syscall]:
        github.com/aquasecurity/libbpfgo._Cfunc_bpf_link__destroy(0x7f942c710290)
                _cgo_gotypes.go:554 +0x4c
        github.com/aquasecurity/libbpfgo.(*BPFLink).Destroy.func1(0xa9ee1c?)
                /root/go/pkg/mod/github.com/aquasecurity/libbpfgo@v0.4.6-libbpf-1.1.0/libbpfgo.go:195 +0x46
        github.com/aquasecurity/libbpfgo.(*BPFLink).Destroy(0xc000fa98c0)
                /root/go/pkg/mod/github.com/aquasecurity/libbpfgo@v0.4.6-libbpf-1.1.0/libbpfgo.go:195 +0x25
        github.com/aquasecurity/tracee/pkg/ebpf/probes.(*traceProbe).detach(0xc0016e0570, {0xc003749b38?, 0xac5886?, 0xc0009396e0?})
                /home/gg/code/tracee/pkg/ebpf/probes/trace.go:82 +0x36
        github.com/aquasecurity/tracee/pkg/ebpf/probes.(*probes).DetachAll(0xc0009396f8?)
                /home/gg/code/tracee/pkg/ebpf/probes/probes.go:188 +0x92
        github.com/aquasecurity/tracee/pkg/ebpf.(*Tracee).Close.func1()
                /home/gg/code/tracee/pkg/ebpf/tracee.go:1428 +0x3a
        github.com/aquasecurity/tracee/pkg/capabilities.(*Capabilities).Required(0xc0002930c0, 0xc003749c68?)
                /home/gg/code/tracee/pkg/capabilities/capabilities.go:174 +0xc4
        github.com/aquasecurity/tracee/pkg/ebpf.(*Tracee).Close(0xc000612500)
                /home/gg/code/tracee/pkg/ebpf/tracee.go:1425 +0x89
        github.com/aquasecurity/tracee/pkg/ebpf.(*Tracee).Run(0xc000612500, {0x22a9d20, 0xc0010a0000})
                /home/gg/code/tracee/pkg/ebpf/tracee.go:1419 +0x8a5
        created by github.com/aquasecurity/tracee/tests/integration.startTracee
                /home/gg/code/tracee/tests/integration/tracee.go:72 +0x3f1
        ]
--- FAIL: Test_EventFilters (29.57s)

Context:

This seemed a false positive and is being solved after aquasecurity/trace#2784 was merged and through work on aquasecurity/trace#2688.