coroot/coroot-node-agent

Fail to create eBPF map in `TestProcessEvents`.

Opened this issue · 0 comments

Version: coroot-node-agent-v1.21.4

In the terminal:

vagrant@ubuntu2004:/tmp/src$ VM='ubuntu2004' go test -p 1 -count 1 -v ./ebpftracer/...
go: downloading github.com/containerd/cgroups v1.0.4
I0910 07:20:22.924156   14920 net.go:20] whitelisted public IPs: []
=== RUN   TestProcessEvents
    tracer_test.go:329: 
        	Error Trace:	/tmp/src/ebpftracer/tracer_test.go:329
        	            				/snap/go/10335/src/runtime/asm_amd64.s:1594
        	Error:      	Received unexpected error:
        	            	failed to load collection: map iovec_buf_heap: map create: operation not permitted (MEMLOCK may be too low, consider rlimit.RemoveMemlock)
        	Test:       	TestProcessEvents
--- FAIL: TestProcessEvents (3.11s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8c9a99]

goroutine 4 [running]:
testing.tRunner.func1.2({0x937f40, 0x13cc4f0})
	/snap/go/10335/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	/snap/go/10335/src/testing/testing.go:1399 +0x39f
panic({0x937f40, 0x13cc4f0})
	/snap/go/10335/src/runtime/panic.go:884 +0x212
github.com/coroot/coroot-node-agent/ebpftracer.TestProcessEvents(0xc000158820)
	/tmp/src/ebpftracer/tracer_test.go:66 +0x399
testing.tRunner(0xc000158820, 0x10029b0)
	/snap/go/10335/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	/snap/go/10335/src/testing/testing.go:1493 +0x35f
FAIL	github.com/coroot/coroot-node-agent/ebpftracer	3.125s

Considering that we have unlock unix.RLIMIT_MEMLOCK at ebpftracer/tracer.go:220, I wonder maybe we should change the memry config at ebpftracer/Vagrantfile:14