-
Notifications
You must be signed in to change notification settings - Fork 103
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
Check for and log information about stale osquery database lock files #2006
base: main
Are you sure you want to change the base?
Conversation
ebe2a4c
to
a833edf
Compare
511dbb0
07f0c5b
to
32d9ed3
Compare
d7a1d24
to
897aa0e
Compare
897aa0e
to
ea7ea44
Compare
@@ -80,3 +82,39 @@ func isExitOk(err error) bool { | |||
} | |||
return false | |||
} | |||
|
|||
func getProcessesHoldingFile(ctx context.Context, pathToFile string) ([]*process.Process, error) { |
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.
I think this is a fairly expensive call. Might be okay, given how infrequent it occurs. But we should know that it's not cheap
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.
It takes about 6 seconds in test, which is definitely not nothing. But we'll only hit this if the lock file exists -- and in that case, we'll never successfully start up osquery anyway, so the delay is a moot point. I figure we can remove this once we have more info from the logs to figure out how to detect/remediate.
Relates to #2004.
launcher is currently completely unable to recover if the osquery lock file is left behind. However, we want to be cautious about removing this file. For now, we detect whether there's a stale lock file, and collect + log information about it if so.
Also adds a test for launching an instance, plus a test for detecting lock file presence.