fix: the ebpf program in the tcpretrans plugin failed to load
Description
Fix the issues of abnormal status of retina-agent caused by opening tcpretrans plugin. The retina-agent nil pointer is because the Tracer.socketEnricherMap field of the tcpretrans plugin is nil.
Related Issue
#311
Checklist
- [x] I have read the contributing documentation.
- [x] I signed and signed-off the commits (
git commit -S -s ...). See this documentation on signing commits. - [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [ ] I have followed the project's style guidelines.
- [ ] I have updated the documentation, if necessary.
- [ ] I have added tests, if applicable.
Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.
@wenhuwang this doesn't seem to fully resolve the problem. Instead of a nil pointer, now there is an error instantiating the socketEnricher:
failed to reconcile plugin tcpretrans: failed to new socketEnricher: read BPF iterator: checking if current pid namespace is host pid namespace: host.Init() must be called before calling isHostNamespace()
@wenhuwang this doesn't seem to fully resolve the problem. Instead of a nil pointer, now there is an error instantiating the socketEnricher:
failed to reconcile plugin tcpretrans: failed to new socketEnricher: read BPF iterator: checking if current pid namespace is host pid namespace: host.Init() must be called before calling isHostNamespace()
@rbtr Sorry for the late reply, I'm on vacation recently. I have tested it locally before. I will verify this problem in a few days.
I have not reproduced this problem and retina-agent status is normal in local environment .
failed to reconcile plugin tcpretrans: failed to new socketEnricher: read BPF iterator: checking if current pid namespace is host pid namespace: host.Init() must be called before calling isHostNamespace()
platform: OS: Ubuntu 18.04.5 LTS Kubernetes Version: 1.22.2 Host: self-host Kernel Version: 5.10.87-051087-generic Retina Version: v0.0.8
Do you have any specific steps to reproduce the problem? @rbtr
Thanks for the change. Can you add details as to how you verified this change?
- Before adding this change, the retina-agent would panic because of the nil pointer.
- After adding this change, retina-agent runs normally and can get tcpretrans plugin metrics.
- When troubleshooting the following problem through the logs, I can only see the "Initialized tcpretrans plugin" log but not the "failed to new socketEnricher" related logs.
failed to reconcile plugin tcpretrans: failed to new socketEnricher: read BPF iterator: checking if current pid namespace is host pid namespace: host.Init() must be called before calling isHostNamespace()