-
Notifications
You must be signed in to change notification settings - Fork 260
Remove Orphan lock file #445
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #445 +/- ##
==========================================
- Coverage 53.32% 53.29% -0.03%
==========================================
Files 28 28
Lines 4032 4034 +2
==========================================
Hits 2150 2150
- Misses 1610 1612 +2
Partials 272 272
Continue to review full report at Codecov.
|
jaer-tsun
left a comment
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.
/lgtm
cni/plugin.go
Outdated
| log.Printf("[CNI] Process name for pid %s is %s", pid, pName) | ||
|
|
||
| if pName != processName { | ||
| return true |
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.
can you add a log here? This will help us debug where log can show that we successfully removed the lock
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 have already added log in other place before removing lock file
fixed trim line ending
…working into removeLockFile # Conflicts: # cni/ipam/plugin/main.go
cni/ipam/plugin/main.go
Outdated
| fmt.Printf("Failed to initialize key-value store of ipam plugin, err:%v.\n", err) | ||
|
|
||
| if isSafe, err := ipamPlugin.Plugin.IsSafeToRemoveLock(ipamPlugin.Plugin.Name); isSafe { | ||
| log.Printf("[IPAM] Removing lock file as process holding lock exited. Error:%v", err) |
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.
You are not logging the err when isSafe is false - which is where we get non-nil err.
You are always logging nil error.
| // check if that matches with our expected process | ||
| pName, err := platform.GetProcessNameByID(string(content)) | ||
| if err != nil { | ||
| return true, nil |
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.
if GetProcessNameByID returned err due to some internal err, we would end up deleting the lock file even if the process which acquired the lock is running.
I think we should return false here. Let's discuss this if you want.
* added removeorphanlockfile function * remove lock file if process holding that exited * addressed comments * addressed comments and added a condition to check get process cmd is supported * Addressed comments fixed trim line ending * updated log
What this PR does / why we need it:
This PR make sure that CNI process is not blocked bacause of orphaned lock file. The cni will remove lock file if the process that is holding lockfile exited
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: