-
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
Merged
RebeccaMahany
merged 19 commits into
kolide:main
from
RebeccaMahany:becca/rm-old-db-lock
Dec 30, 2024
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a833edf
Check for and clean up old osquery database lock files before startin…
RebeccaMahany 2c83441
Retry removing lock file
RebeccaMahany 26e3846
Merge remote-tracking branch 'upstream/main' into becca/rm-old-db-lock
RebeccaMahany 5ec7393
No remediate, only detect
RebeccaMahany 511dbb0
Log more info
RebeccaMahany e65370a
Handle multiple processes holding file
RebeccaMahany ddaf28a
Merge remote-tracking branch 'upstream/main' into becca/rm-old-db-lock
RebeccaMahany 432caa2
Fix open files check
RebeccaMahany a7ce8f0
Use IsRunning over Status since it's supported on Windows
RebeccaMahany f24b66c
Use Username over UIDs since it's supported on Windows
RebeccaMahany 025bd99
Rename var
RebeccaMahany cf1392f
Better error messages
RebeccaMahany 32d9ed3
Merge remote-tracking branch 'upstream/main' into becca/rm-old-db-lock
RebeccaMahany ea7ea44
Try actually opening file too
RebeccaMahany fe65f8a
Skip test in GHA
RebeccaMahany b026008
Merge branch 'main' into becca/rm-old-db-lock
RebeccaMahany ea739ee
Merge branch 'main' into becca/rm-old-db-lock
RebeccaMahany c03d92f
Merge branch 'main' into becca/rm-old-db-lock
RebeccaMahany fc409fd
Fix rebase
RebeccaMahany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package runtime | ||
|
||
import ( | ||
"syscall" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func createLockFile(t *testing.T, fileToLock string) { | ||
lockFile, err := syscall.Open(fileToLock, syscall.O_CREAT|syscall.O_RDONLY, 0600) | ||
require.NoError(t, err) | ||
require.NoError(t, syscall.Flock(lockFile, syscall.LOCK_EX|syscall.LOCK_NB)) | ||
t.Cleanup(func() { | ||
syscall.Close(lockFile) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wish we had a better option, but I concur we do not.