eBPF tracking is sometimes disabled
Describe the bug When starting probe, we sometimes get this message:
<probe> WARN: 2022/01/25 15:03:36.666483 Error setting up the eBPF tracker, falling back to proc scanning: cannot write "p:ptcp_v4_connect tcp_v4_connect\n" to kprobe_events: write /sys/kernel/debug/tracing/kprobe_events: file exists
To Reproduce Steps to reproduce the behavior:
- Start the agent
- Kill it abruptly with a
SIGTERM - Start the agent again
Expected behavior eBPF tracking should be starting
Components/Services affected
- [ ] UI/Frontend
- [ ] API/Backend
- [x] Agent
- [ ] Deployment/YAMLs
- [ ] CI/CD Integration
- [ ] Other (specify)
The file exists error happens because we try to add the same entry twice to the /sys/kernel/debug/tracing/kprobe_events. The reason why the entry was not cleaned up properly needs to be further investigated. My assumption is we might are calling the Close function correctly here but it somehow never gets called (because of signals)
Fix for enabling eBPF tracker even if the entry is already present: c90f416
Closing this, reopen if required.