-
Notifications
You must be signed in to change notification settings - Fork 449
remove pid file on exit #3075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove pid file on exit #3075
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem of having the PID file internal to Tracee{}
library, instead of part of the main.go
, which should create the pid file as the first thing, and clean it up at the end of it.
For anything using the pid file as a metric to know if tracee is alive or not (tracee-action does it, and k8s files might do it in the future), cleaning inside the lib, means those services will think tracee is not live and either stop docker or restart the container, even though there is logic to be execute after t.Run()
like drain the chan of events, for example.
So if possible, maybe we could fix this problem here? Ideally we should remove the pid creation from inside the lib, and have it under cmd/tracee.go
as the first and last thing before the process exits.
@josedonizetti this e5c1cea is a proposal based on your concerns. I couldn't extract it to main as the pidfile uses capture output path logic which is only set in Runner.Run(). But with that I was able to extract the creation and destruction of the pidfile to the highest execution path. WDYT? |
I think this problem is bigger than what this PR comes to solve (#3074 (comment)) and we should probably tackle it later. In the future, I believe the liveness/readiness probes can be implemented using our API server, and not through this pid file. |
@yanivagman Liveness/readiness will use the server, that is why we introduced the |
@josedonizetti if you agree with this solution let's merge it. |
70193b7
to
eb0ed15
Compare
This also does some cosmetic changes to the code and adds utils.RemoveAt() wrapper.
1. Explain what the PR does
2. Explain how to test it
then
and watch:
3. Other comments
Fix: #3074