-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
patch for issue #39 #121
patch for issue #39 #121
Conversation
You should write better commit message, like use a proper subject. You may take this one as an example:4e24410 |
@lizf-os Sorry for the simple comment. I revised the comment. |
if cmdline, err := ioutil.ReadFile(procPath); err == nil { | ||
_, exeName := filepath.Split(string(cmdline)) | ||
exeName = exeName[0:4] | ||
if exeName[0:4] == "runc" { |
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.
At this point exeName[0:4] is equal to exeName. You should remove the line above or just use exeName here.
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.
@mikedanese Actually, exeName ends with white character and the length of exeName is 5. Therefore the expression is required. Instead, the line can be refined as exeName[0:len(runcName) - 1] if "runc" is assigned into contant runcName.
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'm not sure I'm following you. I'm saying at line 168 exeName is equal to exeName[0:4] and len(exeName) == 4
because you set exeName = exeName[0:4]
the line before. In the same way, for any string s s == s[0:len(s)]
. This code would function the exact same way without line 167.
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.
@mikedanese oh, I got the point. I understood.
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.
another thought, line 167 will panic with 'slice bounds out of range' if the exeName is less than 4 characters long.
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.
@mikedanese yes, thanks. I will modify the code
What if runc is called from an absolute path? |
@mikedanese it works fine |
Ahh ok I see. |
runc always shows "container in use" if /var/run/ocf/container exists However, there are two cases 1) case 1: "container in use" 2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash For case 2, runc should yield "delete the lock dir" instead of "container in use" This patch is for this issue using "pid" file in /var/run/ocf/container/task Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com> patch for issue opencontainers#39: runc always shows "container in use" if /var/run/ocf/container exists However, there are two cases 1) case 1: "container in use" 2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash For case 2, runc should yield "delete the lock dir" instead of "container in use" This patch is for this issue using "pid" file in /var/run/ocf/container/task Also, I refined indentation and added code for slice length check Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
I revised the code as commented |
runc always shows "container in use" if /var/run/ocf/container exists However, there are two cases 1) case 1: "container in use" 2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash For case 2, runc should yield "delete the lock dir" instead of "container in use" This patch is for this issue using "pid" file in /var/run/ocf/container/task minor revision opencontainers#1: error indentation, slice length check for "exeName" minor revision opencontainers#2: use "filepath.join" instead of "fmt.Sprintf" Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
I think we can close this as kill command was added in #178 |
…omment-typo runtime_config_linux: Fix 'LinuxSpec' -> 'LinuxRuntimeSpec' in comment
Signed-off-by: Jin-Hwan Jeong jhjeong.kr@gmail.com