gojue/ecapture

fatal error: concurrent map read and map write

easyrelax opened this issue · 1 comments

Describe the bug
()[root@node-2 ecapture-v0.7.2-linux-x86_64]# ./ecapture tls --libssl=/lib64/libssl.so.10 -p 20
The eCapture terminates after running for a while and reports the following error:

Result:
tls_2024/01/25 10:58:33 PID:36031, Comm:hagent-api, TID:36031, Version:TLS1_2_VERSION, Recived 2 bytes from 0.0.0.0, Payload:

tls_2024/01/25 10:58:33 PID:36031, Comm:hagent-api, TID:36031, Version:TLS1_2_VERSION, Recived 5 bytes from 0.0.0.0, Payload:
0

fatal error: concurrent map read and map write

goroutine 51 [running]:
ecapture/user/module.(*MOpenSSLProbe).GetConn(...)
/home/runner/work/ecapture/ecapture/user/module/probe_openssl.go:331
ecapture/user/module.(*MOpenSSLProbe).dumpSslData(0xc000104840, 0xc000825300)
/home/runner/work/ecapture/ecapture/user/module/probe_openssl.go:557 +0x1ad
ecapture/user/module.(*MOpenSSLProbe).Dispatcher(0xc000830420?, {0xa5ea70?, 0xc000825300?})
/home/runner/work/ecapture/ecapture/user/module/probe_openssl.go:548 +0x1c7
ecapture/user/module.(*Module).Dispatcher(0xc000104840, {0xa5ea70, 0xc000825300})
/home/runner/work/ecapture/ecapture/user/module/imodule.go:304 +0x1f0
ecapture/user/module.(*Module).perfEventReader.func1()
/home/runner/work/ecapture/ecapture/user/module/imodule.go:231 +0x37a
created by ecapture/user/module.(*Module).perfEventReader in goroutine 1
/home/runner/work/ecapture/ecapture/user/module/imodule.go:199 +0x2e9

goroutine 1 [chan receive]:
ecapture/cli/cmd.openSSLCommandFunc(0xc00016ee00?, {0x975ad4?, 0x4?, 0x975a18?})
/home/runner/work/ecapture/ecapture/cli/cmd/tls.go:145 +0xd6e
github.com/spf13/cobra.(*Command).execute(0x10a1600, {0xc000173710, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x67b
github.com/spf13/cobra.(*Command).ExecuteC(0x10a1380)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
ecapture/cli/cmd.Execute()
/home/runner/work/ecapture/ecapture/cli/cmd/root.go:75 +0x10b
ecapture/cli.Start(...)
/home/runner/work/ecapture/ecapture/cli/main.go:22
main.main()
/home/runner/work/ecapture/ecapture/main.go:73 +0x28e

goroutine 21 [syscall]:
os/signal.signal_recv()
/opt/hostedtoolcache/go/1.21.0/x64/src/runtime/sigqueue.go:152 +0x29
os/signal.loop()
/opt/hostedtoolcache/go/1.21.0/x64/src/os/signal/signal_unix.go:23 +0x13
created by os/signal.Notify.func1.1 in goroutine 1
/opt/hostedtoolcache/go/1.21.0/x64/src/os/signal/signal.go:151 +0x1f

goroutine 3 [chan receive]:
ecapture/user/module.(*Module).run(0xc000104840)
/home/runner/work/ecapture/ecapture/user/module/imodule.go:155 +0x2f
ecapture/user/module.(*Module).Run.func1()
/home/runner/work/ecapture/ecapture/user/module/imodule.go:133 +0x17
created by ecapture/user/module.(*Module).Run in goroutine 1
/home/runner/work/ecapture/ecapture/user/module/imodule.go:132 +0xc5

goroutine 49 [chan receive]:
ecapture/pkg/event_processor.(*EventProcessor).Serve(...)
/home/runner/work/ecapture/ecapture/pkg/event_processor/processor.go:56
ecapture/user/module.(*Module).Run.func2()
/home/runner/work/ecapture/ecapture/user/module/imodule.go:137 +0x2f
created by ecapture/user/module.(*Module).Run in goroutine 1
/home/runner/work/ecapture/ecapture/user/module/imodule.go:136 +0x105

goroutine 50 [chan receive]:
ecapture/user/module.(*Module).readEvents.func1()
/home/runner/work/ecapture/ecapture/user/module/imodule.go:170 +0xcf
created by ecapture/user/module.(*Module).readEvents in goroutine 1
/home/runner/work/ecapture/ecapture/user/module/imodule.go:167 +0x8d

goroutine 52 [running]:
goroutine running on other thread; stack unavailable
created by ecapture/user/module.(*Module).perfEventReader in goroutine 1
/home/runner/work/ecapture/ecapture/user/module/imodule.go:199 +0x2e9
()[root@node-2 ecapture-v0.7.2-linux-x86_64]#

To Reproduce
Steps to reproduce the behavior:
./ecapture tls --libssl=/lib64/libssl.so.10 -p 20

Expected behavior
Continuous and stable operation of eCapture

Linux Server

  • Env:
    Download the binary package and run it
    ()[root@node-2 ecapture-v0.7.2-linux-x86_64]# ./ecapture -v
    2024/01/25 11:13:33 Your environment is like a container. We won't be able to detect the BTF configuration.
    ecapture version: linux_x86_64:v0.7.2:5.15.0-1053-azure
  • OS: CentOS8
  • Arch: x86_64
  • Kernel Version: 4.18.0-147.5.1.es8_24.x86_64

thanks, please retry #468